[whatwg] Canvas 2d methods

On Sun, 2 Jul 2006, Andrew Fedoniouk wrote:
> 
> 1) if it is declared as
> var foo = something;  in current frame then
> foo.bar();
> foo.baz();
> then execution is quite efficient.
> 
> But
> with(something)
> {
>    bar();
>    baz();
> }
> 
> still requires scan of the whole universe in the worst case.

But this isn't the worst case! It's the best case -- you know exactly what 
a 2D context's members are.


> Consider this:
> 
> with(ctx)
> {
>    bar( some_var_name );
> }
> 
> runtime will scan full chain of ctx for some_var_name. What for?

It will scan *exactly* the same places as it would have if you didn't have 
the "with", plus the context itself.


Anyway, this is all a straw man -- this isn't the reason that the spec 
doesn't allow this. It doesn't allow this because Safari didn't do it this 
way in the first place, and changing it would likely introduce bugs (while 
still not helping authors for some time anyway).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 2 July 2006 14:18:51 UTC