> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jon Zeppieri
> Sent: 2. april 2008 19:06
> To: Lars Hansen
> Cc: es4-discuss@mozilla.org
> Subject: Re: Strict mode recap
> 
> On 4/2/08, Lars Hansen <[EMAIL PROTECTED]> wrote:
> >  >
> >  > Lars, does this mean that expr::[expr] can't introduce  
> > lexical 
> > bindings?  Or:  in strict mode, it can't, but in  > standard it can?
> >
> >
> > It can't introduce bindings; it's just a name.
> 
> I meant something like:
> 
> var foo::[bar] = baz;
> 
> My objection to expr::[expr] in earlier messages was based on 
> the assumption that these computed names could be used on the 
> left-hand side of an assignment expression -- which, I'm 
> pretty sure, is syntactically valid.

But that by itself can't introduce bindings (except global ones).

> So, for example:
> 
> var foo = "hello";
> null::["foo"] = "goodbye";
> print(foo); // prints "goodbye"
> 
> But I guess there are two cases: one where a new binding 
> would be introduced and another where the expression would 
> evaluate to an already bound name (as in the previous example).
> 
> So... are either of those cases legal?

If you want to introduce a new binding then you have to do eg

  ns var x = E

to introduce ns::x, and ns has to reference a namespace 
definition, so it's not variable.  Nor is the x, obviously.
But in that case:

  var v1 = ns
  var v2 = "x"
  v1::[v2] = 20

updates ns::x, AFAIK.  Nothing you can't do with lexically
scoped eval.

--lars
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to