Proposal: opt-out local scoping

Brendan Eich brendan at mozilla.org
Thu Aug 28 15:05:26 PDT 2008


On Aug 28, 2008, at 2:59 PM, Ingvar von Schoultz wrote:

> Dave Herman wrote:
>> Reformed `with' depended on type annotations and structural type  
>> syntax,
>> which are undergoing discussion. So I think reformed `with' is up  
>> in the
>> air for now.
>
> I find it odd that reformed |with| required such exact type
> annotations, when nothing else does.

Please read

http://wiki.ecmascript.org/doku.php?id=proposals:reformed_with

the last paragraph in particular.


> It would seem that these
> are very similar, from an early-binding viewpoint:
>
>      var {a, b, c} = fn();
>      x = a;
>
>      var obj = fn();
>      x = obj.a;
>      with (obj : {a, b, c})
>      {   x = a; // Desugars to obj.a
>      }

Your example includes neither type constraints nor mutation.


> Equally it would seem that disambiguating syntax would allow
> early binding, if it were enforced:
>
>      with (obj)
>      {   x = .a; // Desugars to obj.a

New syntax could solve the ambiguity problem, but not the type  
variance problem.

/be

>          y = a;  // From the lexical scope
>      }
>
> -- 
> Ingvar von Schoultz
>
> _______________________________________________
> Es-discuss mailing list
> Es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the Es-discuss mailing list