Re:Rick Santorum's Fake Donation Meter
by stevewilhelm on Friday May 25, 2012 @07:59PM
(#4025891)
Was just looking at namespace best practices today for a utility library I was implementing. Is there a defacto standard?
[ Parent
| on HN ]
Re:Rick Santorum's Fake Donation Meter
by aaronasterling on Friday May 25, 2012 @08:43PM
(#4025998)
The defacto standard is to put nothing in an enclosing namespace unless it's needed there. The purpose of functions (especially in a language like JS) is to wrap up everything that's needed to accomplish a given task and leave no mess behind.
Then why oh why are variables global by default? (this is not meant as an attack on your point, I fully agree, I just find this awfully frustrating about JS. Sane languages have scoped by default and a global keyword, not the other way around)
Re:Rick Santorum's Fake Donation Meter
by aaronasterling on Thursday May 31, 2012 @06:16PM
(#4050693)
You'd have to ask its designer. Sloppy programmers do like globals and JS was targeted for them.