- From: Keean Schupke <keean@fry-it.com>
- Date: Wed, 12 Jan 2011 07:58:11 +0000
- To: Jonas Sicking <jonas@sicking.cc>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Jeremy Orlow <jorlow@chromium.org>, robert@ocallahan.org, Glenn Maynard <glenn@zewt.org>, Charles Pritchard <chuck@jumis.com>, public-webapps WG <public-webapps@w3.org>
- Message-ID: <AANLkTim3s6OW3f8cbhQ8qFZVROugTxFXR0zbiWKoF4B9@mail.gmail.com>
Now I think about it I see where you were coming from with get: var x = getNamedStorage('x'); x.onsuccess(function(store) {...}); would make more sense like that... and I guess if you include the onsuccess callback in one function you get: getNamedStorage('x', function(store) {...}); I reads better this morning than it did last night. Cheers, Keean. On 12 January 2011 07:51, Keean Schupke <keean@fry-it.com> wrote: > The callback is doing something 'with' the resource you are waiting for. > The callback cannot be called 'without' the resource being available. The > 'with' refers to the 'named storage object' not the registration of the > callback. > > "with" this named storage object "do" function > > > Would be how I read it. > > > Cheers, > Keean. > > > On 12 January 2011 07:48, Jonas Sicking <jonas@sicking.cc> wrote: > >> On Tue, Jan 11, 2011 at 6:02 PM, Tab Atkins Jr. <jackalmage@gmail.com> >> wrote: >> > On Tue, Jan 11, 2011 at 4:39 PM, Jonas Sicking <jonas@sicking.cc> >> wrote: >> >> On Tue, Jan 11, 2011 at 2:44 PM, Tab Atkins Jr. <jackalmage@gmail.com> >> wrote: >> >>> On Tue, Jan 11, 2011 at 2:37 PM, Jonas Sicking <jonas@sicking.cc> >> wrote: >> >>>> On Tue, Jan 11, 2011 at 2:11 PM, Keean Schupke <keean@fry-it.com> >> wrote: >> >>>>> would: >> >>>>> withNamedStorage('x', function(store) {...}); >> >>>>> make more sense from a naming point of view? >> >>>> >> >>>> I have a different association for 'with', especially in context of >> >>>> JavaScript, so I prefer 'get'. But others feel free to express an >> >>>> opinion. >> >>> >> >>> In the context of other languages with similar constructs (request a >> >>> resource which is available within the body of the construct), the >> >>> "with[resource]" naming scheme is pretty common and well-known. I >> >>> personally like it. >> >> >> >> Even for asynchronous callbacks? Can you give any examples? >> > >> > Not *quite* asynchronous callbacks (that's something fairly specific >> > to languages that run on an event loop), but close enough. >> > >> > Lisp has, for example, macros like WITH-HASH-TABLE-ITERATOR, which >> > takes a hash, a name for the iterator to be produced, and then a chunk >> > of code within which the iterator is available. >> > >> > Python has its "with" keyword, used like "with file = open('foo'): >> > doStuffToTheFile(file)", which similarly creates a named resource and >> > takes a chunk of code within which the resource is available. I know >> > that other languages have similar, but off the top of my head I'm >> > having trouble thinking of them. >> >> All of these seem very similar to the 'with' operator in javascript, >> but quite different from a function which registers a asynchronous >> callback. >> >> / Jonas >> > >
Received on Wednesday, 12 January 2011 07:58:45 UTC