Strict mode recap

Lars Hansen lhansen at adobe.com
Fri Apr 4 10:25:42 PDT 2008


> -----Original Message-----
> From: Jon Zeppieri [mailto:zeppieri at gmail.com] 
> Sent: 4. april 2008 11:02
> To: Lars Hansen
> Cc: liorean; es4-discuss at mozilla.org
> Subject: Re: Strict mode recap
> 
> On Fri, Apr 4, 2008 at 12:57 PM, Lars Hansen 
> <lhansen at adobe.com> wrote:
> >
> > (BTW I believe that locally bound names in ES4 cannot have explicit

> > namespaces, but that these names are defined in the common public  
> > namespace (the one Jon calls 'null' though it will probably end  up 
> > being called 'public').  The forthcoming spec on names and name  
> > lookup will clarify.)
> 
> Wait... so what have we been arguing about?

I don't know what *you* have been arguing about :)  I have been arguing
that allowing a general reference form ns::[expr] where both ns and expr
can be arbitrary expressions does not inhibit optimizations in a
significant way, nor does a form ns::id where ns is an arbitrary
expression, and furthermore that these forms have utility.

Classes can have namespaced properties and globals can too.  These
objects are in scope in a method (say), so in order to reference a
property in them from the method, at a minimum the form ns::id must be
available to the program (for constant ns and id).  But since ns can be
'public' such a name can (as far as I understand it know) also match a
local binding (parameter, let, var -- whatever), so this syntax is not
at present restricted to finding properties in true (non activation
record) objects.  I hope the forthcoming spec on names will clarify
this, so I suggest we hold off arguing about this particular point for
the moment.

When ns and id are indeed constant then all sorts of early binding
optimizations can be performed.  If ns is not constant, or if id is
actually some [expr], then the lookup is still by the same rules as for
early binding, clearly, but it will have to be performed at run-time.

You can argue, and I think you are arguing, that there is no utility in
allowing ns to be variable and allowing id to be replaced by [expr].  I
disagree, based on my experience analyzing uses of eval in scripts
written for the web, which to an astonishing degree evaluate simple
variable names or object.property phrases.

--lars



More information about the Es4-discuss mailing list