On Tue, May 7, 2013 at 4:38 PM, Jonas Sicking <jonas@sicking.cc> wrote: > On Tue, May 7, 2013 at 3:16 PM, David Sheets <kosmo.zb@gmail.com> wrote: > > Could you please explain which part of the promise concept makes this > > eager evaluation necessary? > > The promise concept doesn't. But I've not seen any libraries that > permit it. I.e. I haven't seen any libraries that allow the creator of > the promise to be notified when someone registers to be notified about > the value. > Hi Jonas, although I agree with your overall point, Q.makeRemote as defined at < https://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/ses/makeQ.js#458> does enable the creator of a remote promise to detect when it has been .then-ed. This is sufficient to express promises that lazily evaluate, although not conveniently and not the purpose of the API. > > >> So they do not provide the ability to postpone a calculation until > >> someone that has access to the promise requests the calculation to be > >> performed. > > > > I have a promise library on my disk that does provide this ability. It > > is a trivial extension. > > The question isn't what can be implemented. The question is what > existing libraries and code does as that is an indication of what > people have requested. Agreed. Q.makeRemote exists so that the distributed systems code stretching Q between machines can be written in JS as a client of Q without surprising or unnecessary special privilege. -- Cheers, --MarkMReceived on Wednesday, 8 May 2013 00:09:19 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC