Till, Jeff, and I had some discussion about naming conventions for self-hosted JavaScript - would be good to get input from others. I tossed in a few more cases that I've come across.
a) Should we follow established JavaScript conventions and allow only constructor and namespace names to start with a capital letter (i.e., Array and Intl)? Or should we follow the SpiderMonkey C/C++ conventions, which allow other functions to be capitalized? Note that the latter requires turning off checking for proper usage of "new" in JSHint (yes, I do think we should use code checkers). Concrete cases: -- Should the function implementing Array.prototype.indexOf be named ArrayIndexOf, arrayIndexOf, or array_indexOf? -- Should the function implementing the ECMAScript abstract operation ToInteger be named ToInteger, toInteger, or __ToInteger? b) Should the names of macros indicate how they're implemented or should they just look like other functions? -- Should the macro checking for undefined be named IS_UNDEFINED or isUndefined? -- Should the macro implementing the ECMAScript abstract operation ToUint32 be named TO_UINT32 or (depending on the decision for ToInteger above) ToUint32, toUint32, or __ToUint32? c) Should we prefix the names of global functions and variables to create name spaces? The implementation of the internationalization API has quite a few of those, and to prevent clashes with code that other people may add in the future I prefixed them with "intl_". (Many of these globals can also be hidden inside a function closure once nested functions work in self-hosted code). Comments? Thanks, Norbert _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals