Names strawman ready for discussion

Sam Tobin-Hochstadt samth at ccs.neu.edu
Thu Sep 9 10:55:06 PDT 2010


On Thu, Sep 9, 2010 at 10:08 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote:
> However, I wonder if it would be possible to get the best of both worlds.
> IIUC, the Names proposal converts:
> private x;
> this.x = "foo";
> this.x
>
> into:
> let x = new Name;
> this[x] = "foo";
> this[x]
> Would it be possible to instead rewrite it to:
> let x = new ExplicitSoftField();
> x.set(this, "foo");
> x.get(this)
> (using the same rules for determining the scope of 'x' as detailed in the
> Names proposal)
> You would get the 'private' scoping of Names, and the concise syntax,
> without the limitations that MarkM raised. Am I missing something?

I don't think this will work with more sophisticated uses of names,
where 'private' isn't used.  For example, this function:

function lookup(obj,key) {
  return obj[key];
}

won't work properly without Names as real values.

-- 
sam th
samth at ccs.neu.edu


More information about the es-discuss mailing list