Strategies for standardizing mistakes
Allen.Wirfs-Brock at microsoft.com
Thu Oct 15 14:18:17 PDT 2009
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Maciej Stachowiak
>Sent: Thursday, October 15, 2009 7:23 AM
>On Oct 14, 2009, at 5:04 PM, Jim Blandy wrote:
>> It could just be organizational bias, but reluctant properties
>> strike me as the more bounded form of insanity.
>Before you conclude that, let's consider the impact of host object
>properties that return different values based on their syntactic
>context. From the informal operational semantics given form ECMAScript
>syntactic constructs, one might conclude that certain source-to-source
>program transforms are sound, in the sense that they cannot possibly
>alter the behavior of the program. Consider these two functions. I
>will use %EXPR% as a metasyntactic variable, indicating any valid
Maciej's thought experiment touches upon the fundamental evil of host objects. In the presence of host objects there is no firm foundation for understanding the semantics of an ECMAScript program. Adding some additional restrictions on host objects only reduces the insanity but doesn't eliminate it. That's why some of us would like to see ECMAScript semantics expanded so that all of the essential characteristics of Web APIs can be directly expressed in the ECMAScript language without having to use the host object loophole (and would like to set any Web API features that can't be support with rational ES features on the deprecation path).
The argument about which document.all anti-detection semantics most closely complies with the standard's host object exemptions is pointless. The same scenario could have just as easily come about because IE (or any other browser) added a useful native object and some large group of users adopted it as a form of browser detection. You'd have the same problem and probably would have arrived at the same solutions but won't have the host objects exemptions to use as defense for the hack.
Death to host objects!!
More information about the es-discuss