Labs/Jetpack/Reboot/Best Practices: Difference between revisions

Jump to navigation Jump to search
added note on use of 'new' operator.
(added another bullet point)
(added note on use of 'new' operator.)
Line 15: Line 15:
* Some Cuddlefish modules, like file.js, take pains to be broadly compatible as JS modules and loadable as-is in Web pages, in addition to being SecurableModules used in Jetpack.  Do we really want to go that route for all modules?
* Some Cuddlefish modules, like file.js, take pains to be broadly compatible as JS modules and loadable as-is in Web pages, in addition to being SecurableModules used in Jetpack.  Do we really want to go that route for all modules?
* Creating code that can exist side-by-side with different versions of itself; implies not mutating the outside environment in certain ways.
* Creating code that can exist side-by-side with different versions of itself; implies not mutating the outside environment in certain ways.
* When creating objects, do we want <tt>jetpack.thing()</tt> or <tt>new jetpack.Thing()</tt>?
** Atul has found the case of forgetting the "new" operator to be unforgivingly difficult to debug.
** Atul has also found that "new" operator problems are hard to debug when the operator associates w/ a different operand than one intends, e.g. <tt>new require("foo").Bar()</tt>.
874

edits

Navigation menu