On Jun 16, 2008, at 8:09 PM, Mark S. Miller wrote: > On Mon, Jun 16, 2008 at 2:45 PM, Mark S. Miller > <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 16, 2008 at 2:07 PM, Douglas Crockford >> <[EMAIL PROTECTED]> wrote: >>> I agree that it is weird that ES4 wants to retain with, but that >>> in itself does not disturb the superset relationship. >> >> Before we retreat into less formal notions of subsetting, could >> someone please explain why ES4 wants to retain "with" in ES4 strict >> mode? > > > Given the silence,
I am not going to repeat what I wrote at an earlier point in this thread (13 June at 10:24) -- you didn't reply to what I wrote then. Did that message not reach you? > I thought it might be worth pointing out: > > * "Reformed with" was dropped from ES4 strict because it wasn't enough > less horrible than "with" to be worth it. That's not the reason for dropping it. It was considered sufficient to migrate existing 'with' into, as well as support novel 'with' uses under, ES4 strict mode -- without loss of lexical scope. But it was not cheap (requiring invariant type checking), and it was a special case that could be cut without affecting the core language. The degree to which it would be used was open to debate. Again, is the carrot of strict mode worth the stick of adding type annotations to 'with' heads? Forbidding 'with' in strict mode raises the "rewrite tax" beyond an addition to the 'with' head, requiring analysis and rewriting to use a short-hand let binding to denote the head object. There is no "let ref" (Modula 3); it's not enough to destructure object properties into individual same-named let bindings, because mutations won't update the object's properties. > If "reformed with" isn't > good enough, does anyone think "with" is somehow better than "reformed > with"? The question isn't whether an existing statement is "good enough", it's whether a strict mode that bans it is "usable enough". > * Given Brendan's and Maciej's clarifications, it seems that "with" is > the *only* remaining feature of ES4 strict preventing static scope > analysis. The global object still allows new names to be usable via lexical references, where the names were not bound at static analysis (compile) time. > If the ES4 folks still wish to include "with" in ES4 strict, perhaps > they can clarify what they see as the purpose of strict mode. Because > I'm completely baffled. Methinks you protest too much. You are right to point to reformed with, since it was my idea for making with tolerable to an earlier notion of 'use strict' -- strict mode as a verifier, which would need to see name bindings in order to do type checking. This old notion of strict mode was to be an optional feature, at the implementation's discretion. We dropped it in favor of 'use strict' a la Perl -- "use good taste and sanity". Without type checking, the argument against unreformed 'with' is reduced to one about static scope -- but the global object still frustrates static scope, so is kicking 'with' out of strict mode worth it, especially if it impairs adoption of "use strict"? /be _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss