Modules: Curly Free
dherman at mozilla.com
Mon Apr 22 15:09:03 PDT 2013
On Apr 22, 2013, at 9:43 AM, Kevin Smith <zenparsing at gmail.com> wrote:
> Dave, what do you think about the syntax tweaks I presented upthread?
I think it's okay. I could go into detail but I don't think it'll go well in this thread, so I won't.
> I feel pretty strongly that if we're going to do this, then we should follow Node and make the default "default" the module instance object. That way the "default" represents the chosen "entry point" for the module, and there is always some such "entry point". What do you think?
It's a bad idea. It forces you into a default export if you don't have one, and makes it a breaking API change if you want to add one. It becomes an attractive nuisance where clients can use it as an alternative for the module binding form (`import module` in your syntax), which then makes it impossible for a library author to add a default export later.
More information about the es-discuss