Yes. This is our (lazy) way of implementing classes in ES3, which we should fix if it means Max can work on more important things than doing the compiler's job by hand. Too bad we don't have a compiler guru on the OL team...
Basically, the compiler is doing a very simple analysis of each method body, and if there are _any_ free references in the body, it wraps `with(this)` around the body to simulate the lexical lookup of instance var's. With a teeny bit more mechanism, the compiler could instead compare those free references to the the instance vars in the class model and rewrite them to `this.`, dispensing with the need for `with(this)`. This should result in a significant speed-up in our DHTML code, because `with` slows all free lookups (and is not even available in ES5 strict). I haven't prioritized this in the past, because, long-term, we should adopt a more modern implementation of classes in DHTML, based on traits (http://code.google.com/p/es-lab/wiki/Traits), when we can reliably expect all browsers to be supporting ES5. And, none of this is a problem on as3, because it _already_ implements lexical binding of instance vars in classes correctly. On 2010-12-03, at 15:21, Henry Minsky wrote: > What's going on with "with(this)" ? Is the compiler putting in when it sees > what it thinks is a free global reference? > > On Fri, Dec 3, 2010 at 8:17 AM, P T Withington <[email protected]>wrote: > >> Approved. It's damned annoying the compiler is not figuring that out for >> itself. >> >> We should upgrade corner radius to handle 8 values and move the >> borderradius parser into lz/mixins (or maybe just add it to boxmodel)? >> >>
