Proposal: Concise instance initialisation

Rick Waldron waldron.rick at gmail.com
Mon May 23 14:44:56 PDT 2011


Please excuse me, I'm just looking for clarification - thanks in advance:


> Also, the current infix writable mark does not compose with "Implicit
> property initialization expressions" [1] as noted in [2].  Using a
> prefix fixes this:
>
> let a = {!b}
>

This conflicts with the existing:

var foo = "bar";
{foo}  // "bar"
{!foo} // false



> I don't think that's an issue, these all look backward compatible to me:
>
> !a.b = c
> !a[b] = c
> ~a.b = c
> ~a.b += c
> #a.b = c
> #!~ a[b] *= c
>
>
Ignoring the lines prefixed "#"; all of these are currently invalid left
hand assignment reference errors. Take away the assignments and the first
two are negations, the second two bitwise not operations. So I'm wondering
if they become "backward compatible" by simply becoming allowed, parsable
syntax?



> Also, if destructuring were then extended to allow the individual
> LHS's to be property references rather than just Identifiers,
> something like this would work:
>
> var [a, #~this.b, !this.c] = arguments;
>
>
Forgive me if I've misunderstood, assuming "#~" is somehow allowable, the
third would still be negated with logical not, right?


Again, thanks for the clarification.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110523/57eafe58/attachment.html>


More information about the es-discuss mailing list