Hacker News new | past | comments | ask | show | jobs | submit login

One good reason is to avoid polluting the global namespace.

Otherwise you end up like Mathematica, which has ten thousand or so functions in a single namespace.

Or PHP which had (has?) a similar problem (but on a smaller scale).




You can easily split stuff into modules without getting classes involved. For example the `Math` module which has been in JS basically forever.


But they are on the global namespace. E.g. new Set() is same as new window.Set()


Right, but just the constructor. Everything else is a method of Set/Temporal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: