Strategies for standardizing mistakes

Jim Blandy jimb at mozilla.com
Thu Oct 15 10:06:21 PDT 2009


On 10/15/2009 07:23 AM, Maciej Stachowiak wrote:
>
> The latter, if truly allowed by the spec, makes source-to-source 
> transformers, even something as simple as a pretty-printer, 
> potentially unsound. That seems like a much less bounded form of 
> insanity.
>
I think this point is well-taken.

In the case of 'eval', ES5 requires an implementation to inspect the 
context of the call.  A direct call to eval runs the code in the call's 
environment; indirect calls run in the global environment.  This makes 
eval into a pseudo-syntactic form: really, expressions of the form 
'eval(...)' are special to the compiler, regardless of eval's binding.

The way Mozilla treats 'document.all' seems analogous.

> (It's been raised that debugging APIs may have behavior that depends 
> on the calling context. That may be true, but exposing debugging APIs 
> directly to normal code would violate important assumptions.
Well, my point there was more that approaching the question in terms of 
whether a given behavior is permitted by the spec doesn't advance the 
conversation much.  For native objects, the spec is powerless to forbid 
truly horrible things; it's too low a bar.



More information about the es-discuss mailing list