News for hackers. Stuff that matters.
Re:The void of undefined in JavaScript by drostie on Friday July 12, 2013 @10:02AM (#6032598)
> Let's say someone is using your library within that function and you reference undefined. You get the string "oops". Oops indeed.

That is incorrect. It might be correct if the word 'library' was replaced by 'code snippet' to indicate a copy-and-paste-of-your-code issue. But if you've created a library then your functions are over in some other file, where `typeof undefined === "undefined"`.

The proper attitude here is the same as the Python attitude towards not having `private` attributes: "If some other programmers want to do something crazy with my code, that's their prerogative. If it blows up in their faces, that's their problem."

Re:The void of undefined in JavaScript by kaoD on Friday July 12, 2013 @11:34AM (#6033117)
Even if it was in the same file, as long as it's in a different function it'll work.

If `undefined` is an argument name, it's only bound inside that function and nowhere else.

Re:The void of undefined in JavaScript by lmm on Friday July 12, 2013 @10:43AM (#6032838)
I used to believe this, but I now realise it's insufficient when building large apps. Upgrading the version of Django (or indeed Rails) you depend on requires a comprehensive testsuite and involves changes to your code. Upgrading the version of Wicket you depend on is easy because the framework is able to enforce that you only access the attributes you're meant to, only subclass things that are designed to be extended, etc.