Allen Wirfs-Brock (2014-12-16T07:20:11.000Z)
d at domenic.me (2015-01-05T20:32:01.411Z)
On Dec 15, 2014, at 10:06 PM, Brendan Eich wrote: > So assigning `a = 2` won't affect the value of the default export, but will rebind `a`, given preceding `export default function a() {}` -- right? It does both. 'a' is rebound to 2 and since the export name 'default' associates to 'a', any subsequent references in other modules tht are linked to the default export of this module will also see 2 because 'default' is really just the export name for 'a'. > Hmm, how's that work? Throwaway symbol name? Well ultimately it's all linkages that at the implementation level hopefully resolve external (ie imported) references into direct references to exported variable binding. At the spec. level, I just define a non-identifer name ("*default*") to the binding created by a anonymous 'export default'. There can only be one per modules. It turns out all the declaration instantiation, binding lookup, and module linking mechanism in the spec. work fine with such a name, so there is actually very few special cases in the spec. for such anonymous default exports. See https://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-exports-static-semantics-exportentries for how exports associate an export name with either a local binding name or an import name from some other module. > I ask because Glen also wondered about the Module Record being reified in one of his posts. That's spec-internal, though (again, correction welcome). Right, Module Record is just internal spec. mechanism used to define the module semantics. It currently isn't reified.