Forwards-compatible syntax proposal

liorean liorean at
Sat May 17 00:16:03 PDT 2008

> On Sat, May 17, 2008 at 3:21 PM, Lars Hansen <lhansen at> wrote:
>>  I've spent some time examining
>> compatibility between ES3 and ES4 [1].  Opt-in to ES4 keeps you out of
>> most trouble.

2008/5/17 Steven Mascaro <subs at>:
> That's true if the programmer in question is confident that she's writing
> pure ES4 code. But if she's already comfortable with ES3, she will very
> likely want to move over to ES4 gradually, learning any new syntax bit by
> bit. In that case, she will want to write/copy ES3 code that will run in an
> ES4 interpreter (much like a C programmer might write/copy C code to be
> compiled by a C++ compiler). If the interpretation of code changes between
> ES3 and ES4, she will almost certainly encounter bugs that are very
> difficult to track down.

You're basically saying that ES4 mustn't change the meaning of any ES3
program here. The problem I see with that is that it wouldn't allow
any semantics expansion that reuses the old syntax forms. You'd
confine all language changes to be either pure standards library ones
(which are not entirely safe either, considering that there may be
code in the wild that use these names and objects that are "safe" to
use in ES3) or new syntactic forms that will be guaranteed to produce
a syntax error in ES3, which means they can't exist in present ES3

I don't agree. ES4 must be allowed to correct broken things in ES3 in
case that may provide
security/privacy/integrity/compatibility/sensibility improvements;such
as making sure algorithms don't use hijackable global objects by
making those global objects {DD, RO, DE}; or improve broken mechanisms
like format control characters stripping (a clear case of trying to be
clever and think forward misfiring); or introducing new
identifier-like operator keywords which can take an expression operand
(e.g. the yield example Lars gave).

Opt-in gives you a choice, to check your code for a short list of
things that would produce a difference in ES3 as compared to ES4. With
no opt-in, you don't allow that to happen.

> More generally, I don't believe that requiring developers to opt in to a new
> revision of a language/format/protocol/etc. is a good idea, which is one
> reason why I consider backwards-compatibility critical. I'd be interested to
> hear Hixie's reasons.

In the case of programming languages, I'd much prefer an opt-in than a
model that:
- Doesn't allow correcting obvious mistakes in earlier versions.
- Doesn't allow patching privacy/integrity problems by adding
restrictions on present standards library properties.
- That forces all semantics additions to introduce new syntactic forms
in order to not modify the semantics of certain programs, for example
by prohibiting adding new operators and keywords.
David "liorean" Andersson

More information about the Es4-discuss mailing list