Glen Huang (2014-12-15T16:16:02.000Z)
d at domenic.me (2015-01-05T20:21:36.312Z)
Thank you for the detailed explanation. Now I have a better understand of the export declaration. > I would have no idea what `export default var a = 1;` was supposed to mean. Looking back, this does seem unclear, but indulge me to share how I come up with the proposed syntax: I was trying to export a point data structure for the mouse position. This was my initial try: ```js export var x = 0; export var y = 0; document.addEventListener(“mousemove”, (ev) => {clientX: x, clientY: y} = ev); ``` But then I realized in order to consume it, i need to do `import * as mousePosition from …`. This doesn’t look right to me, because the exported obj isn't an aggregation of independent things (the `* as …` syntax looks like a reminder that properties are independent), I want to use it like `import mousePosition from …`. So giving the experience of you can merge export and a variable declaration into a single line, I tried to do: ```js export default var pt = { x: 0, y: 0 }; document.addEventListener(“mousemove”, (ev) => {clientX: pt.x, clientY: pt.y} = ev); // hope i got the destructuring assignment right ``` Thus this proposal. So obviously “merging” concept doesn’t apply when default is involved, and I now know why. Thanks again.