names [Was: Approach of new Object methods in ES5]
brendan at mozilla.com
Mon Apr 19 14:25:15 PDT 2010
On Apr 19, 2010, at 4:27 PM, Peter van der Zee wrote:
> Basically, this means we cannot introduce new language constructs or
> syntax because older implementations will trip over the code with no
> way to recover. Furthermore, for various reasons it seems "feature
> detection" is favored over version detection.
When you want the new syntax, though, you're going to have to use opt-
in versioning (see RFC4329).
> ES5 introduced the concept of directives, using perfectly fine
> fallback with no side effects. This was, as far as the above goes,
> perfect. Older implementations couldn't possibly trip over it since
> a string literal without anything else has no visible side effects.
I should point out again that "use strict"; changes runtime semantics
involving eval and arguments in ES5, it does not merely prevent
programs from getting to runtime (i.e., it is not just stricter
syntax, e.g. forbidding 'with').
This means that if you "use strict" you have to test your code in pre-
ES5 and ES5-or-above implementations, to be sure you're not counting
on the ES5 changes.
Usually you won't have a problem, but testing is the only way to be
sure, if you are using eval and/or arguments in your strict code.
More information about the es-discuss