Hacker News new | past | comments | ask | show | jobs | submit login
Strict Mode Is Coming To Town (yuiblog.com)
52 points by bootload on Jan 13, 2011 | hide | past | favorite | 12 comments



Current state of support for strict mode:

WebKit nightly: yes

Firefox 4 nightly: yes

Chromium Nightly: no

Opera 10.6: no

IE9 beta: no


Do no currently shipping browsers support it?


Any info on Node.js?


To be followed by use warnings, use integer, use bytes, use 5.008, etc.


If only they would add "use Lua"...


"The arguments pseudo array becomes a little bit more array-like in ES5. In strict mode, it loses its callee and caller properties."

Anyone know what replaces this?

How would I write this (stupid code that would eventually blow the stack) without arguments.callee?

    (function () {
        console.log("hello world");
        setTimeout(arguments.callee, 1000);
    })();


    (function foo() {
        console.log("hello world");
        setTimeout(foo, 1000);
    })();


It looks like you're forced to use a named lambda.


> In C, an extremely unfortunate representation of octalness was selected: Leading zero. So in C, 0100 means 64, not 100, and 08 is an error, not 8. Even more unfortunately, this anachronism has been copied into nearly all modern languages, including JavaScript, where it is only used to create errors.

I've never tripped on 0100 != 100 (and never heard of anyone who did — every programmer I've talked to knew leading zero has special meaning), but this "anachronism" allowed me to conveniently write `fs.chmod(path, 0640, cb);`. Thank you, ECMA, for pointless runtime calculations with `parseInt("0640", 8)`.


When would someone actually want to use octal literals in a C program? I never understood why C has this "feature". In contract, binary literals would have actually been useful.

EDIT: After RTFA'ing, I see that octal was useful for hardware with 60 bit words.


Agreed, they should at least replace it with 0o777 or something. While they're at it I wouldn't mind 0b10101 notation either.

Considering javascript as a browser only language is shortsighted, especially given the existence of things like Node.js.


Semi-unrelated: I don't understand the note at the bottom or the linked document about the XSS problem. Is there actually a way to prevent XSS that's under consideration?




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

Search: