Forwards-compatible syntax proposal
zwetan
zwetan at gmail.com
Tue May 13 07:39:22 PDT 2008
On Fri, May 9, 2008 at 4:18 AM, Ian Hickson <ian at hixie.ch> wrote:
>
> One of the problems with ES4 relative to ES3 is that the new syntax means
> that a script using ES4 features doesn't work in ES3 compilers.
>
> There's not much we can do in the ES3-ES4 language migration about this.
> But we _can_ prevent this problem from existing again in ES5 and up.
>
[...]
>
> I may have missed some things we should include, and the grammar above may
> be too simple and may have to have changes made, but hopefully it conveys
> the basic idea.
>
> Comments?
>
what about
http://wiki.ecmascript.org/doku.php?id=proposals:versioning
and
http://wiki.ecmascript.org/doku.php?id=discussion:versioning
?
if I read those documents well
ES1-4 support backward-compatibility
and later for ES5 etc.
we could either use
application/ecmascript;version=5
or the global
__MAX_ECMASCRIPT_VERSION__
or the pragma
use edition 5
re-reading what you're asking
> But we _can_ prevent this problem from existing again in ES5 and up.
do you mean you wish an ES5 script to be able to run in an ES4
interpreter/compiler ?
I don' think that 1) it's possible and 2) it's wishable
if you got
application/ecmascript;version=4
and want to run a ES5 script, you fall in the same situation as ES3.1 vs ES4
see http://wiki.ecmascript.org/doku.php?id=proposals:versioning
"Modifications of Global Bindings
Changing global object bindings is incompatible with ES4.
If ES3 or ES3.1 code tries to overwrite these bindings before any ES4
code has executed in the current document, these bindings are changed,
but further ES4 scripts will not execute in that document.
If ES3 or ES3.1 code tries to overwrite these bindings after any ES4
code has executed in the current document, the bindings will be
treated as readonly and the attempt to change them will fail
silently."
so ES3.1 and ES4 are a special situation,
but in the context of having an ES5 script running inside an ES4
interpreter and having errors failing silently
that could be really a hell to debug.
cheers,
zwetan
More information about the Es4-discuss
mailing list