Strict mode recap

Mark Miller erights at gmail.com
Mon Mar 31 20:35:45 PDT 2008


On Mon, Mar 31, 2008 at 7:09 PM, Lars Hansen <lhansen at adobe.com> wrote:
>  > [mailto:es4-discuss-bounces at mozilla.org] On Behalf Of Waldemar Horwat
>  > - delete o.x when x is not in o but in the proto will throw
>
>  Actually delete o.x when x is not an own property on o,
>  regardless of whether x in o.

I didn't understand this.


>  > - Disable FunctionObject.arguments (not actually in ES3 but
>  > woefully used in practice)
>
>  This is an interesting one, since disallowing it would mean that
>  the ES3.1 and ES4 specs would have to re-allow it so that they could
>  explicitly disallow it :)

Yes. It's also an interesting test of how strong our stomachs are in
codifying reality. Any web browser that doesn't provide these will
break  (or be broken by) the web. However, it has never been specified
and should never have been implemented or used. I do think that
standards mode should include it and strict mode should ban it.
Otherwise, de-facto JavaScript continues to differ too greatly from
what's documented.


>  > - Prohibit 'with' and locally scoped 'eval'.  Globally scoped
>  > 'eval', 'new Function', etc. would still be allowed.
>
>  Having thought more about this, we may get away with less
>  draconian measures for lexically scoped eval -- it's enough
>  to simply decree that eval may not add bindings to the
>  caller's binding object in strict mode (a simple run-time check,
>  effectively the same as disabling global variable auto-creation).
>
>  The observation is that reference forms like expr::[expr] require
>  the same functionality as the constrained, lexically scoped eval
>  would require anyway, so the benefit of outlawing eval except for
>  matters of taste is doubtful both in terms of implementation cost
>  and simplified semantics.

It's interesting. I have become so allergic to locally-scoped eval
that I started writing down my killer arguments against it. They all
dissolved in the writing. It still makes me deeply uncomfortable, but
your milder restriction actually deals with all the killer arguments I
was able to generate so far. Hmmm...


>  Thanks for posting the list, I will put together a coherent
>  proposal we can discuss.

Looking forward to it!


-- 
Text by me above is hereby placed in the public domain

 Cheers,
 --MarkM



More information about the Es4-discuss mailing list