3 ms·
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
by 323 5y ago
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).
- adam_arthur 5y agoBut they are on the global namespace. E.g. new Set() is same as new window.Set()
- 323 5y agoRight, but just the constructor. Everything else is a method of Set/Temporal.
- paavohtl 5y agoYou can easily split stuff into modules without getting classes involved. For example the `Math` module which has been in JS basically forever.