W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: How to correctly spec sequences requiring an iterable

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 15 Nov 2013 14:02:51 -0500
Message-ID: <52866FDB.5090101@mit.edu>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: Jason Orendorff <jason.orendorff@gmail.com>, public-script-coord@w3.org
> This is an API design issue and I'd argument that such an overload is bad design.

And yet here we are with IDBDatabase and IDBObjectStore which very 
purposefully introduced such an overload.

And we have jQuery.prototype.init which allows overloading a "selector" 
for which typeof returns string with various other stuff including 

And if you look at jQuery's makeArray it has bits like:

   if ( isArraylike( Object(arr) ) ) {
     jQuery.merge( ret,
                   typeof arr === "string" ? [ arr ] : arr

(note that their isArraylike returns true for strings).

Or cases all over where jQuery overloads strings and objects:

   options = typeof options === "string" ?
     ( optionsCache[ options ] || createOptions( options ) ) :
     jQuery.extend( {}, options );

(consider what happens if "options" is a String object!).

And lots of other places all over jQuery that treat primitive strings 
differently from String objects.

Now either jQuery is full of bad API design here, or people actually 
want APIs like this in some cases...

Received on Friday, 15 November 2013 19:03:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:19 UTC