On 13.04.2011 22:25, Brendan Eich wrote:
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).

Yeah, quite a normal implementation. But I'm curious how will it be possible to address a dynamically formed property name -- the name of the global var?

this["foo" + bar]


  It'll be the WindowProxy as usual, in top level code. Dave has addressed what 
it will be in a module recently.



I have to look on Dave's explanation, seems I missed it. But this WindowProxy won't be assessable then, right? Will it be possible to define a new global property/variable at all at runtime depending on condition?

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?

Oh, yes of course, sorry.

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.

You mean it was hard for Coffee to implement this foo?.bar? etc?

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



Sorry, I didn't get from these two sentences -- whether postfix ? is good or not? :D (really sorry, just a translation hardness).

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;


Hm, not good. The whole ambiguity of this construct with casual a ? : c already makes it not good for me. And by the way, Coffee didn't have ? : it uses inline if - then instead.

(well, actually it's possible to write in Coffee a = b ? b : c, but it compiles into completely different semantics).

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

Yes, I got it.

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



Don't know, not so seems. And by the way, in my view, the operator is not "?." (i.e. "a question followed by a dot"), but still just ?. The following dot is already about property accessor:

foo.bar?.baz

again, bar? is separated, and only after that it's accessed to `baz` via casual dot notation.


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

Reply via email to