maian330 at gmail.com
Mon Feb 5 19:44:07 PST 2007
Brendan Eich wrote:
> On Feb 4, 2007, at 6:45 PM, Yuh-Ruey Chen wrote:
> > Although if the environment doesn't define the types for host objects,
> > or at least typeOf(host_object), it would be a large hassle... (typeOf
> > is the function to get the type of an object, right?)
> intrinsic::typeOf -- see http://developer.mozilla.org/es4/proposals/
> meta_objects.html. Note well that this is an optional reflection
> library, not guaranteed to be present in all ES4 implementations.
> It may or may not be a hassle to name or repeat a structural type,
> but if you are migrating old code or dealing with the persistence of
> with, and you want to avoid severe deoptimization, reformed with
> gives you a way at lower cost than rewriting to eliminate the with.
> >> If you need a subset view on the object (with access to other
> >> variables outside
> >> the with having the same name as properties of the object) then I
> >> agree with
> >> you, reformed with is cumbersome and most people would not use it,
> >> unless
> >> the subset view could be named and used several places.
> > Hmm...this should never be the case when revising an ES3 with
> > statement.
> Why not? I can recall ES3 (ES1, or JS1 would be more accurate) code
> that thinks it knows what x means in a with body, but is sometimes
> unpleasantly surprised. A subset view would help fix bugs while
> migrating this old code.
I wasn't disagreeing that a subset view would be nice. I meant that
since they aren't supported in ES3, it should never be the case that
such a feature would be useful when migrating _correct_ ES3 with code.
> >> I agree. At the last committee meeting we discussed putting some
> >> restrictions
> >> on classical "with" in strict mode (though the minutes do not
> >> record any
> >> conclusions). If we were to do that, however, the reformed with
> >> might fare
> >> better.
> > Do you mean that in strict mode, |with(o)| would be translated to
> > |with(o:typeOf(o))| where typeOf(o) is determined at compile-time? If
> > so, that would be nice.
> Not sure what Lars meant, but I saw something like that and found it
> attractive at first. However, intrinsic::typeOf(o) is a runtime
> expression, as well as a call to an optional library function.
> Imputing it here in the case of with-under-strict-mode is unusual and
> something TG1 members seem to be against, but we're still debating.
Well, intrinsic::typeOf doesn't have to be used - I meant what
Withington said. I'll leave it at that.
> > Would there be any possibility of using something similar for standard
> > mode? |with(o:typeOf(o))| would be incompatible with |with(o)| in
> > standard mode, but it would be nice if there was a shortcut syntax for
> > the former. In the above example, it would be nice to do
> > |with(this.DOMTable:<something>)| instead of
> > |with(this.DOMTable:typeOf(this.DOMTable)| (although on the other
> > hand,
> > I'm not a fan of adding a new syntactic construct for a possibly
> > uncommonly used feature).
> There's no reason for any of this given reformed with (http://
That would require knowing the structural type of this.DOMTable. Oh
well, calling typeOf(this.DOMTable) would be more expensive than a
persistent reference to the structural type, so I guess it's a necessary
More information about the Es4-discuss