On 2008-03-20, at 15:05 EDT, Max Carlson wrote:
P T Withington wrote:
Not approved: I think the stretches issue needs a different
solution. See comments below.
<snip>
Good catch. I wonder if there are other setters in components?
Also, consider following the pattern in LzView#setResource: move
the body into $lzc$set_... and make the old setter method a
deprecated trampoline, to encourage people to use setAttribute
(which will be in-lined, and will call the $lzc$set_... directly).
We want the 'normal' path to be the fast path.
I'm working on an updated patch that applies this transformation to
the most commonly called methods.
I'm concerned about application size if we inline the entire
setAttribute() method in user code. The compiler could certainly
inline calls to known setters by transforming
setAttribute('foo', ...) -> $lzc_set_foo(...).
If this is the plan, then changing the trampoline order and
deprecating the original setter methods (with warnings) makes
sense. If not, we should probably leave the original methods in
place because they'll be faster for user code.
This is indeed eventually the plan. JS2 will allow us to say:
function set foo (v) { ... };
and transform:
foo = 3;
into:
'set foo'(3);
So it will be trivial to inline setAttribute.