W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: [IndexedDB] Closing on bug 9903 (collations)

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Tue, 3 May 2011 10:27:37 -0400
Message-ID: <BANLkTimd=mO5PKuyLGFhtjcbdtXFXv765w@mail.gmail.com>
To: Keean Schupke <keean@fry-it.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Pablo Castro <Pablo.Castro@microsoft.com>, "public-webapps@w3.org" <public-webapps@w3.org>
On Tue, May 3, 2011 at 3:19 AM, Keean Schupke <keean@fry-it.com> wrote:
> The more I think about it, the more I want a user-specified comparison
> function. Efficiency should not be an issue here - the engines should tweek
> the JIT compiler to fix any efficiency issues. Just let the user pass a
> closure (remember functions are first-class in JavaScript so this is not a
> callback nor an event).

Wouldn't it be a bit more complicated than just passing a regular
closure?  The function has to be persisted in the database across page
views, but a JavaScript closure is going to contain references to all
sorts of objects (like document, or local variables) that are very
specific to the current page view.  It makes no sense to persist those
objects in general.  You'd need to serialize the function somehow,
possibly putting restrictions on the sorts of variables it can access,
so that it can be sensibly restored later.  Is there some established
way of doing this yet in JavaScript?  It might be useful in other
contexts too.

I still agree that this is the correct direction to go in, though.
Received on Tuesday, 3 May 2011 14:28:24 UTC

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