jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

Module Factory function should be renamed. #84

Closed johnjbarton closed 10 years ago

johnjbarton commented 10 years ago

By a wide margin JS developers use Capital names for constructors. The Module Factory function is not a constructor, has no prototype, and is not to be called with 'new'. Ergo it should not be 'Module( obj )'. Lower case would just be confusing.

Note: The Module factory function reflectively creates module instance objects.

IMO this is an action function that calls for an action name: createModule(), coatModule(), createModuleInstance().

arv commented 10 years ago

Why not new Module?

jorendorff commented 10 years ago

Yeah. It used to be new Module, and people on TC39 complained that that suggests prototype inheritance, which modules don't have.

If you care about this, es-discuss is good for bikeshedding of this kind. @dherman suggests maybe Reflect.module() is the right color.