On Apr 13, 2011, at 8:01 PM, Dmitry A. Soshnikov wrote:

> (regardless that ES6 will have compile-time bindings, it still possible to 
> create global var at runtime via `this.bar`, though, if there will be no 
> global object, I'm not sure how this applies to the ES6)

No, Harmony won't alias this to the global scope (which is lexical, not an 
object). It'll be the WindowProxy as usual, in top level code. Dave has 
addressed what it will be in a module recently.


> is "too noisy" in contrast with:
> 
> foo.bar?.baz?quax("value");
> 
> and first of all, this syntactic sugar is proposed exactly this such cases.

Did you leave out a . after the second . in that example?

I had dinner with Jeremy Ashkenas last month, and he testified that 
CoffeeScript's disamgibuator pass (between lexing and parsing) is a work in 
progress and a work of (literately programmed) random logic, which he has 
tweaked based on user bug reports, even recently.

This is not something to put into ECMA-262. So a postfix ? operator seems right 
out as a general operator, given ?: and ??/??=.


>> How much is this used in CoffeeScript compared to regular .? Some crude 
>> measurement would be helpful.
>> 
> 
> Can't say precisely (and even roughly). But personally I used it pair of 
> times, it was convenient.
> 
> Notice also, this form can be used even in this view:
> 
> let foo = bar? && baz? : true : false;
> 
> which tests for exactly existence of bar and baz.

OTOH, if ? as an identifier suffix, no space allowed, were added to Harmony, 
then we would have a migration tax in the form of an early error, which *might* 
be ok:

  // old code, note lack of space between a and ?
  x = a? b : c;

Harmony treating ? as an identifier suffix as an existential test would then 
find the run-on fragment "b : c;" a syntax error.

This still seems a bit shaky. Is it important compared to ?. and part of the 
"same package deal"?

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to