Allen Wirfs-Brock <mailto:[email protected]>
January 30, 2012 10:17 AM
On Jan 30, 2012, at 5:00 AM, Andreas Rossberg wrote:
On 28 January 2012 02:08, Allen Wirfs-Brock<[email protected]> wrote:
I played around a bit to see if I could come up with a troublesome example
of the sort you may be thinking about. What I came up with is the follow:
<script>
module a {
import {x:y} from b;
I think you wanted to say {y:x} here.
no, I think {x:y} means creating a binding for x that is linked to b.y
No, the binding name is in the property value position. This is why the
shorthand works: import {x} from b; would bind local x to b.x.
Some find this "backwards" but it has to be this way -- the property
name destructured from the RHS is on the left of : and the binding name
is on the right. The shorthand helps in most cases, and
backwards-sensitive people learn :-|.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss