News for hackers. Stuff that matters.
Re:The void of undefined in JavaScript by lubomir on Friday July 12, 2013 @07:52AM (#6032099)
> […] if you throw your scripts out there on the web you've got to expect that somewhere, at some time someone is going to do it […]

And then it will be that persons' problem. Their code would be wrong, not mine. By not making sure my code works when undefined is broken, I would be helping them to realize they have a possible bug in their codebase and that they need to fix it.

Re:The void of undefined in JavaScript by PommeDeTerre on Friday July 12, 2013 @08:13AM (#6032156)
This is one among many serious, and unjustifiable, flaws with JavaScript. It's the kind of issue that should never even arise with anyone's code in the first place, regardless of who wrote the code, because the language and its implementations should not allow it to happen.

And, yes, we know that other languages have flaws, too. But aside from perhaps PHP, the flaws in other languages are almost never as outright stupid as they are with JavaScript.

Re:The void of undefined in JavaScript by coldtea on Saturday July 13, 2013 @05:11AM (#6037094)
>And, yes, we know that other languages have flaws, too. But aside from perhaps PHP, the flaws in other languages are almost never as outright stupid as they are with JavaScript.

Citation needed. There are tons of languages with huge fucking flaws to blow your code and kick your dog.

PHP and Javascript are relatively harmless (if a little brain damaged). At least you don't get buffer overflows using them.

You think C++ has a better design, for example? People forgot how bad Python used to be, pre 2.4?

Re:The void of undefined in JavaScript by pgcsmd on Saturday July 13, 2013 @06:04AM (#6037186)
No, the OP was correct - other languages have flaws but nowhere near the level of Javascript. You pick on C++ which is a design by committee monstrosity but it is nowhere near as braindead as Javascript. I mean, C++ allows you to include other code! C++ doesn't allow you to redefine the constants of the language. Actually, C++ has constants!

Nope, as much as I like to rail against the sins of C++, it is a paragon of design virtue next to JS. I've been programming for three decades now and JS is the worst language I have ever seen. I use JS a lot in my day job and it has parts I really like (object constants, for example) but really, as a piece of language design it is really the pits.

Re:The void of undefined in JavaScript by aboodman on Sunday July 14, 2013 @12:54AM (#6040007)
#define ?
Re:The void of undefined in JavaScript by PommeDeTerre on Monday July 15, 2013 @08:21AM (#6045045)
That's not really a C++ construct, as much as it is a hold-over from C, kept around to retain compatibility with existing code.

If you're writing new C++ code, you're in no way forced to use it. You can use constants or inline functions to achieve the same result in almost all cases.