Luke Hoban wrote:
At least half the times I've shown object destructuring or module import renaming syntax 
I've gotten "don't you have that backwards?" remarks.  I can't say I have a 
better recommendation for the general object destructuring syntax, but I expect this to 
be a point of significant confusion for newcomers to ES6.

We've rehashed this a lot, so I'm going to rehash a point that helps: most object patterns do not need to rename, so use the shorthand:

  let {x, y} = somePoint;

The renaming case as you say cannot reverse property name and binding name (or general LHS in assignments rather than declarations) roles. People will learn. Mozillans have (we didn't add the short-hand until years after adding destructuring in 2006).

Destructuring is quite popular in Mozilla XUL JS. See, e.g., Armin Ronacher's tweet, retweeted by Bob Ippolito:

https://twitter.com/#!/mitsuhiko/status/181023710810091521

http://twitter.theinfo.org/181023710810091521#id181054978247491585

This is not worth rehashing again, rather, it's something to document and teach.

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

Reply via email to