Strict mode recap

Lars Hansen lhansen at adobe.com
Fri Apr 4 08:30:08 PDT 2008


> -----Original Message-----
> From: zeppieri at gmail.com [mailto:zeppieri at gmail.com] On 
> Behalf Of Jon Zeppieri
> Sent: 3. april 2008 21:35
> To: Lars Hansen
> Cc: es4-discuss at mozilla.org
> Subject: Re: Strict mode recap
> 
> >
> > Let me turn it around.
> >
> >  The syntax ns::v is in the language, for constant identifier v.
> >  If E4X is implemented in an implementation (as it will be in  
> > ActionScript and presumably in Firefox, at least), so is  
> ns::[expr].  
> > How would a restriction to require ns to be a  compile-time 
> constant 
> > (in either form) and not a run-time  value, or a restriction to 
> > disallow the latter form in ES4  but not in E4X, benefit ES4?
> >
> 
> From my perspective, it isn't an E4X vs. ES4 distinction; 
> it's a "looking up a property of a first-class object" vs. 
> "using a local variable" (or, if you prefer, "looking up a 
> property of an activation
> object") distinction.  It's not as if this is an uncommon 
> distinction in programming languages, and the advantage of 
> keeping the distinction is better static analysis, better 
> performance, more tractable code.

I don't get it.

Your comment about inhibiting static analysis isn't right; if ns::x is a
name then either ns is known to be constant at compile time or not, and
if it is, then nothing prevents early binding.  ES3 systems perform
analyses that are inhibited by eval and with, and statically detect
whether eval and with are used in order to decide whether to perform the
analyses.

Anyway, what's the distinction between "dynamic lookup of first-class
object properties", as you write in a later message, and looking up a
name in general, once you introduce namespaced bindings in packages and
global objects (though not in local variables) and couple everything
with 'with'?  Are you saying I should be allowed to say (supposing
namespace 'French' exists):

  French::hello()

but not 

  var language = French
  language::hello()

?  What purpose does it serve to have this restriction if static
analysis is not inhibited in the former case, as you wrongly claim it
is?

--lars



More information about the Es4-discuss mailing list