Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn’t modern JS backward compatible with 1.1?


Mostly. See https://tc39.es/ecma262/#sec-additions-and-changes-that-intr... for a comprehensive list of backward-incompatible changes in the spec.

Using that list to answer your question is a bit tricky, since it also includes backward-compatibility breaks with newer features. But, e.g.,

> In ECMAScript 2015, ToNumber applied to a String value now recognizes and converts BinaryIntegerLiteral and OctalIntegerLiteral numeric strings. In previous editions such strings were converted to NaN.

and

> In ECMAScript 2015, the Date prototype object is not a Date instance. In previous editions it was a Date instance whose TimeValue was NaN.

sound like backward-incompatible changes to a JS 1.1 behavior.

Another notable example is the formalization of function-in-block semantics, which broke compatibility with various implementations in order to find a least-bad compromise everyone could interop on. I'm not sure if JS 1.1 even had blocks though, much less functions in blocks...


>Another notable example is the formalization of function-in-block semantics, which broke compatibility with various implementations in order to find a least-bad compromise everyone could interop on. I'm not sure if JS 1.1 even had blocks though, much less functions in blocks...

can you explain what you mean? Did early js implementations not have functions inheriting the block scope?


If they’re referring to lexical block scope then indeed, js historically did not have block scoping, it was function and global scoped.

There are also differences in how eval works, etc


No. Modern javascript engines are compatible with 1.1, but the syntax of modern javascript is not.


Modern JS really isn't even compatible with JavaScript. When people talk about "modern JS" it usually includes TypeScript and a bunch of NodeJS-isms, none of which are compatible with TC-39. It's only by proximity (and perversity) that it even gets to be considered JS.




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

Search: