You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the idea, but JavaScript already has nice namespaces in the form of object literals, and there's no need to introduce special Java-esque syntax for it. In addition, the golden rule of CoffeeScript is "no special functions" ... so the proposed implementation wouldn't pass muster.
I just though it might be a good feature if CoffeeScript did that for you, instead of using the function above to create namespaces or manually doing something like:
var com = com || {};
com.package = com.package || {};
com.package.subpackage = com.package.subpackage || {};
which is annoying, we could use that helper, "__namespace" (borrowed from YUI), in the same way as "__extends" helper is being used to achieve inheritance. But if no special functions is one of the golden rules of CoffeeScript, fair enough ;-)
Hi there,
Another idea I have in mind, implementing some namespacing system, using maybe "namespace" or "package" word, something like
CoffeeScript:
JavaScript output:
Makes sense ?
Thanks
Fran
The text was updated successfully, but these errors were encountered: