On Sat, 1 Jul 2006, Benjamin Joffe 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.

Why is that better than:

   with (ctx) {
     moveTo(0, 0)
     lineTo(10, 10)
     fill()
     stroke()
   }

...?

(Or on one line:

   with (ctx) { moveTo(0, 0); lineTo(10, 10); fill(); stroke(); }

...?)

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

Reply via email to