[Bug 22806] Why special case Date and RegExp in #es-sequence

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22806

--- Comment #9 from Boris Zbarsky <bzbarsky@mit.edu> ---
> you have existing API's that are overloaded with X or sequence<X> where X may
> only be Date or RegExp.

More precisely, WebIDL allows such APIs.  I rather hope no one in practice is
doing that so far with Date and RegExp, though people certainly do it with Node
and Touch and so forth from what I've seen...

> Given how problematic is to make a scalar vs array-like determination for
> general JS objects

For most of the things above, including Date and RegExp, it's not too bad: you
check whether the object is a Date or RegExp instance (or Node, whatever) and
if not, treat it as an arraylike.

But yes, I think the current API best practice for things like that is to use
variadics and assume that people who have an array will use spread operators or
.apply...

> It would be better to describe the existing APIs using prose 

Given past history, I do not trust either spec authors or the average
implementor to get this approach right.  The nice thing with IDL is that it
needs to be implemented once per browser, by someone who knows what they're
doing, and then it just works.

I would much prefer having IDL features explicitly marked as deprecated or
legacy or whatnot than forcing people to write/implement prose, with all the
ensuing problems.

In any case, that's starting to get a bit afield from this bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 31 July 2013 01:33:23 UTC