W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: [IndexedDB] Attributes with undefined vs. null

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 16 Mar 2013 04:35:19 -0700
Message-ID: <CA+c2ei9zMm6jurD1vNFMdoe0ZxFs6Bmiu68xNjx+x9f4FCRUaQ@mail.gmail.com>
To: Joshua Bell <jsbell@chromium.org>
Cc: public-webapps@w3.org
On Wed, Nov 7, 2012 at 10:53 AM, Joshua Bell <jsbell@chromium.org> wrote:
> Various atttributes in IndexedDB signal "no value" with |undefined|:
> IDBKeyRange.lowerBound (if not set)
> IDBKeyRange.upperBound (if not set)
> IDBRequest.result (on error, or on successful deleteDatabase/get with no
> value/delete/clear)
> IDBCursor.key (if no found record)
> IDBCursor.primaryKey (if no found record)
> IDBCursorWithValue.value (if no found record)
> It's been pointed out that most Web platform specs use |null| rather than
> |undefined| for signaling these states. I seem to recall a push in the
> direction of using |undefined| rather than |null| in the IndexedDB spec bit
> over a year ago, but my bugzilla-fu was weak. Can anyone discuss or justify
> this deviation from the norm?
> (I feel like there's been a trend over the past few years in embrace
> ECMAScript's |undefined| value rather than trying to pretend it doesn't
> exist, but that may be my imagination. IDB's use of |undefined| didn't
> strike me as unusual until it was pointed out.)

I think ECMAScript generally tries to think of 'undefined' as 'no
value' whereas 'null' means 'no object'.

So I think in the above cases 'undefined' seems like a better fit.

I don't feel strongly though.

/ Jonas
Received on Saturday, 16 March 2013 11:36:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:59 UTC