W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2006

[whatwg] Canvas 2d methods

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 2 Jul 2006 21:18:51 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0607022116240.4826@dhalsim.dreamhost.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:47 UTC