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

Re: APIs that overload numbers and strings

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 15 Apr 2013 00:50:35 +0200
Message-ID: <CA+c2ei9idsrkegUOLdCn4BFPZ8Yx+nmR2KHuuCU25JMT1B3A4w@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, Ehsan Akhgari <ehsan.akhgari@gmail.com>
On Sat, Apr 13, 2013 at 10:36 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> 3)  The third one is IndexedDB, which allows primitive numbers and primitive
> strings (but not Number or String objects, note) as key values.  It also
> allows Arrays and Dates, but those are a separate concern.  IndexedDB treats
> 42 and "42" as different keys.  Right now it does this via using "any" in
> IDL and then defining the whole thing in terms of introspection of the
> original ES value involved.  This API seems pretty weird to me, at first
> glance, but there is quite a bit of existing library API precedent for
> treating String objects and primitive strings differently, as far as I can
> tell...  Checking for typeof == "string" is pretty common.

Note that if we in indexedDB treated all numbers as strings, that
would mean that 8 would sort between 70 and 90.

/ Jonas
Received on Sunday, 14 April 2013 22:51:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC