On May 24, 2011, at 7:44 AM, Brendan Eich wrote:
> You're right, this would be unambiguous because a block can't initialize a
> var. The only interpretation is an expression, which with Allen's proposal
> combined with object intiialiser shorthand would parse {!b}.
One more thing: {b} in expression context as shorthand for {b: b} is
convenient. In destructuring context var {b} = c, e.g., is totally winning. But
it breaks "alpha conversion" -- if you rename variables in a program with
lexical scope, the result should be equivalent to the original program.
Ok, we can handle this by requiring long-hand expansion first:
... {b: b} ...
Then the {!b} form should expand to ... {!b: b} ... and that may be tolerable
in the hoped-for block/object-literal disambiguation solution.
One thing that might be confusing: ... {!b} ... could be confused for ... {b:
!b} .... People would learn, but the shorthand mixes uneasily with the
retasking of ! and ~ from being unary expression operators to being property
name prefixes.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss