On Mar 22, 2012, at 9:12 AM, Luke Hoban wrote:

>>>>> The bracket syntax is pretty confusing with object literal notation imo.
> 
>>> It shouldn't be too confusing, and the similarity is in fact intentional. 
>>> You should read import as destructuring (and export as the inverse 
>>> structuring, if you want).
> 
> I agree that this isn't really a question specifically for modules, as they 
> are just reusing the destructuring syntax.  But I will say that I've seen a 
> lot of confusion about the object destructuring syntax generally.  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.

I also find myself getting it backwards, but it helps me to remember that for 
destructing assignment the target needs to be an arbitrary LHS which won't 
really fit well to the right of the :

eg

{x:  x[n].setter, y: f().A.B.C.Y} = {x:1,y:2};

The following seems worse:

{x[n].setter:x, y: f().A.B.C.Y:y} = aPoint;
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to