[whatwg] Canvas 2d methods

Andrew Fedoniouk news at terrainformatica.com
Sun Jul 2 14:51:19 PDT 2006

----- Original Message ----- 
From: "Ian Hickson" <ian at hixie.ch>
To: "Andrew Fedoniouk" <news at terrainformatica.com>
Cc: <vladimir at pobox.com>; "Benjamin Joffe" <canvasgame at gmail.com>; 
<whatwg at whatwg.org>
Sent: Sunday, July 02, 2006 2:18 PM
Subject: Re: [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.

And that ctx is pretty heavy thing.
Again, "with" was considered harmful - that was the inital idea of 

> 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).

As far as I can see return value is not defined at all in:
So the proposal is just to define them as returning 'this' instead of 

Andrew Fedoniouk.

More information about the whatwg mailing list