Forwards-compatible syntax proposal
Lars Hansen
lhansen at adobe.com
Fri May 16 22:21:11 PDT 2008
> -----Original Message-----
> From: es4-discuss-bounces at mozilla.org
> [mailto:es4-discuss-bounces at mozilla.org] On Behalf Of Steven Mascaro
> Sent: 16. mai 2008 22:34
> To: es4-discuss at mozilla.org
> Subject: Forwards-compatible syntax proposal
>
> Ian Hickson 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've spent some time examining
compatibility between ES3 and ES4 [1]. Opt-in to ES4 keeps you out of
most trouble.
--lars
[1] http://www.ecmascript.org/es4/spec/incompatibilities.pdf
More information about the Es4-discuss
mailing list