Subset relation (was: RE: ES3.1 Draft: 11 June 2008 version available)

Lars Hansen lhansen at adobe.com
Mon Jun 16 13:49:07 PDT 2008


Intuitively the "subset relation" is determined by the rule that a
processor for version n+d (for d > 0 but not necessarily integer or
indeed rational...) of the language should accept all programs P valid
under version n, and P should evaluate to the same results in version
n+d, except that P may have to be rewritten if:

 1  P uses an identifier that became a keyword in n+d

 2  P makes use of a feature that changed behavor in n+d due to a "bug
fix"

 3  P (or portions of P) is strict, n+d has a stricter strict mode than
n,
    and P runs afoul of a feature that has been firmed up in n+d

 4  P introduces a variable or property on a built-in object or type but
n+d
    has introduced a variable or property of the same name

 5  P relies on exceptions that are thrown by a version n language
processor
    because portions of P are invalid (typically, syntax errors)

Item 1 is handled by opt-in; a version n+d processor is expected to
process a version n program by not recognizing keywords introduced in
n+d, but otherwise treat the program as a version n+d program.

Item 2 has been discussed extensively; the rule of thumb for a bug fix
is that the change must fix many more programs than it breaks.  The
canonical example is the handling of regular expression literals, which
are evaluated once in ES3 programs but every time they are reached
during evaluation in ES4 (and in ES3.1 as far as I could tell from the
latest draft), but a long list is given on the wiki:
http://wiki.ecmascript.org/doku.php?id=proposals:bug_fixes.  (Some of
those are still too big to be simple bug fixes, and some are no longer
approved for inclusion, but most are still good.)

Item 3 hasn't been discussed much, but during the last meeting Brendan,
Mark, and I did talk about it and agreed that it would be OK for strict
modes to become stricter as the language version goes up.  The example
in question was the way ES3.1 wants to deal with number-of-arguments
checking in strict mode: it wants to allow a mismatching number of
arguments in strict mode only if the arguments object is mentioned
explicitly in the program text.  That is a hack not required for ES4,
which has syntax for optional parameters and explicit rest parameters,
and which will want to disallow a mismatching number of arguments in
strict mode in all cases (in other words, there will be limited uses for
the arguments object in ES4 strict mode).

Items 4 and 5 are sanctioned by the ES3 spec (Chapter 16).  In ES4, all
new global names are in the __ES4__ namespace in order to reduce the
risk associated with introducing new global names.

The issue that was raised by the discussion quoted below was whether
strict mode could become /looser/ as the language version goes up; could
ES3.1 outlaw 'with' in strict mode, but ES4 allow it again?  This feels
weird to me.

--lars


> -----Original Message-----
> From: es3.x-discuss-bounces at mozilla.org 
> [mailto:es3.x-discuss-bounces at mozilla.org] On Behalf Of Lars Hansen
> Sent: 12. juni 2008 21:25
> To: Sam Ruby
> Cc: es3.x-discuss at mozilla.org; es4-discuss at mozilla.org
> Subject: RE: ES3.1 Draft: 11 June 2008 version available
> 
> Fair question.  I don't recall that it has been spelled out carefully,
> actually.  I'll take a stab at it in the morning.  (Also, the ES3 ->
> ES3.1 and ES3 -> ES4 relationships are important.)  Any useful
> definition will have to deal with bugfixes and security fixes (like
> global type names being read-only under some circumstances in ES4).
> 
> --lars
> 
> > -----Original Message-----
> > From: sa3ruby at gmail.com [mailto:sa3ruby at gmail.com] On Behalf 
> > Of Sam Ruby
> > Sent: 12. juni 2008 18:46
> > To: Lars Hansen
> > Cc: es3.x-discuss at mozilla.org; es4-discuss at mozilla.org
> > Subject: Re: ES3.1 Draft: 11 June 2008 version available
> > 
> > I'm trying to understand the nature of the ES3.1 - ES4 subset 
> > relationship that this committee has agreed to.
> > 
> > > p69 12.10.  Disallowing the with statement in strict mode 
> breaks the
> > > ES3.1 - ES4 subset relationship (we've found no compelling 
> > reason to 
> > > ban it).
> > 
> > How does having ES4 support *more* than ES3.1 supports break 
> > the subset relationship?
> > 
> > - Sam Ruby
> > 
> _______________________________________________
> Es3.x-discuss mailing list
> Es3.x-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es3.x-discuss
> 



More information about the Es4-discuss mailing list