- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Thu, 9 May 2013 12:09:10 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Andreas Rossberg <rossberg@google.com>, Allen Wirfs-Brock <allen@wirfs-brock.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 5/9/13, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 5/9/13 11:11 AM, Andreas Rossberg wrote: >> I think existing JS legacy notwithstanding it is generally bad >> practice for an API to make an observable distinction between passing >> undefined and not passing anything, especially in the light of ES6's >> treatment of defaults. So I don't think a higher-level declarative >> mechanism like WebIDL should ever want to support that. > > That was sort of my feeling too; just trying to figure out what the > right spec language here is. > > Here's an interesting concrete example: > CanvasRenderingContext2D.drawImage, which is specified like so at the > moment: Too much complexity from overloading and too many parameters. A value object would be a consideration for API redesign. > drawImage(image, 0, 0, undefined); > > should do. In today's world it throws. Should WebIDL preserve the > ability to do that in that situation? > According to the spec, it looks like that isn't valid but I don't see what it says about what happens when four arguments are passed. Likewise for two, six, seven, eight arguments. Normally, extra arguments are ignored so anything over 9 might be predictable, but is four arguments extra or not enough? http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage | This method can be invoked with three different sets of arguments: | drawImage(image, dx, dy) | drawImage(image, dx, dy, dw, dh) | drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) -- Garrett Twitter: @xkit personx.tumblr.com
Received on Thursday, 9 May 2013 19:09:37 UTC