Forwards-compatible syntax proposal
Steven Mascaro
subs at voracity.org
Fri May 16 23:33:29 PDT 2008
On Sat, May 17, 2008 at 3:21 PM, Lars Hansen <lhansen at adobe.com> wrote:
> > >> Another reaction is that there are ES4 source fragments
> > that /can/ be
> > >> parsed by ES3 compilers, but whose meaning will silently
> > be something
> > >> completely different in the two versions of the language.
> > Here are
> > >> some:
> > >>
> > >> // a generator expression in ES4, a loop calling a function
> > >> // in ES3
> > >>
> > >> function f(x) {
> > >> for ( i=0 ; i < 10 ; i++ )
> > >> yield (f(), i)
> > >> }
> > >>
> > >> // (artificial) three statements in ES3, two in ES4
> > >>
> > >> x = this function
> > >> f(x)
> > >> { x++ }
> > >
> > > I think this is very dangerous, and unwise, in the context of the
> Web.
> > > I strongly believe that if we want to have success in expanding the
> > > Web platform, backwards-compatibility is critical. But that's
> another issue.
> >
> > I agree. Lars, surely this is unacceptable by your very own reasoning
> > --- because there will be ES3 code that will run in ES4, but
> > with silently different behaviour.
>
> I don't know what hixie is getting at exactly (whether he's referring to
>
> the first or the second example).
I'd imagine both examples.
> I've spent some time examining
> compatibility between ES3 and ES4 [1]. Opt-in to ES4 keeps you out of
> most trouble.
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.
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.
> --lars
>
> [1] http://www.ecmascript.org/es4/spec/incompatibilities.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080517/cb25062b/attachment-0002.html
More information about the Es4-discuss
mailing list