Strict mode recap

Lars Hansen lhansen at
Fri Apr 11 10:22:47 PDT 2008

> -----Original Message-----
> From: zeppieri at [mailto:zeppieri at] On 
> Behalf Of Jon Zeppieri
> Sent: 11. april 2008 11:10
> To: Lars Hansen
> Cc: es4-discuss at; liorean
> Subject: Re: Strict mode recap
> On Fri, Apr 11, 2008 at 1:05 PM, Jon Zeppieri <jaz at> wrote:
> >
> >  Yep, I agree with this, too.  I certainly wouldn't want to mandate
> >
> >     var public::x
> >
> >  in classes and wouldn't really want to write it myself.  
> But there's  
> > some value in having a single, canonical syntactic form 
> that will work  
> > everywhere.  (If ES5 adds some kind of macro system, it 
> would be more
> >  useful.)
> In case it isn't clear, I'm not asking "Why not drop the 
> Java-like syntax?" but rather, "Why not consider the 
> Java-like syntax as sugar on top of a canonical syntax that 
> works in initializers and classes?"

Because more syntax adds complication without adding value?

Anyhow there are some parsing problems.  Consider that if C is a class
a statically defined namespace property:

  class C {
    static namespace ns = ...

then this is valid:

  class D {
    C.ns var x = ...

but if you try to translate it

  class D {
    var C.ns::x = ...

then you run up against the fact that that parses as C.(ns::x) normally
but would have
to parse as (C.ns)::x here to make sense.  Yet one more rule.

It's not a showstopper, just an indication that it's probably time to
leave well enough alone.  (It _is_ an indication that the syntax used in
the object initializers is not fully general, though, since it only
allows simple identifiers in the namespace position.  Sigh.)

(If ES5 adds macros then we can always extend the syntax for variable
definitions in ES5, we don't need to worry about that now.
Future-proofing -- another principle that has seen some (ab)use in ES4
-- requires only that we don't close off possibilities, not that we make
use of them.)


More information about the Es4-discuss mailing list