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

[whatwg] Canvas 2d methods

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sat, 01 Jul 2006 19:54:36 -0700
Message-ID: <003301c69d82$db136af0$3401a8c0@TERRA>

----- Original Message ----- 
From: "Vladimir Vukicevic" <vladimirv@gmail.com>
To: "Benjamin Joffe" <canvasgame at gmail.com>
Cc: <whatwg at whatwg.org>
Sent: Saturday, July 01, 2006 6:20 PM
Subject: Re: [whatwg] Canvas 2d methods

> On 7/1/06, Benjamin Joffe <canvasgame at gmail.com> wrote:
>> Each of the methods defined for the canvas 2d context return null. I 
>> think
>> it would be very convenient if instead they would return a reference to 
>> the
>> 2d context for that canvas. This would allow writing such code as 
>> ctx.fill
>> ().stroke() or ctx.moveTo(0,0).lineTo(10,10). This is how many of the 
>> native
>> string and array methods work in javaScript.
> This isn't a bad idea; the problem is that the cat's already out of
> the bag here, and developers will end up writing ctx.moveTo()
> ctx.lineTo() etc. for compatability.  I'm a fan of "with" in this
> instance:  with (ctx) { moveTo(0,0); lineTo(10,10); } etc.

In prototype based languages it is almost impossible to implement 'with'
effectively in the given notation.


is more effective. In some circumstances - in times.

Andrew Fedoniouk.
Received on Saturday, 1 July 2006 19:54:36 UTC

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