Re: Promises

2012-11-07 Thread Tom Van Cutsem
2012/11/7 Kevin Smith > > In other words, futures provide synchronisation, while promises >> provide resolution. >> > > This is exactly the API that Q (and it's derivatives) use, although the > nomenclature is different. In Q, the "future" is called

RE: Promises

2012-11-07 Thread Domenic Denicola
rejections > (and by extension, errors thrown from `then` callbacks), should ALWAYS be > observable.  In other words, if a rejection is not observable via error > listeners at the time when error listeners should be called, then an > unhandled error should be thrown by the runtime. >

Re: Promises

2012-11-07 Thread Brendan Eich
2. Once we have DOMPromises implemented, we advocate broader use throughout DOM APIs. 3. Introduce ES7 Promises as a compatible subset of DOMPromises I agree with this approach provided TC39 (not just you) keeps tracking and commenting. public-script-coord is not overused... In an ideal

Re: Promises

2012-11-07 Thread Kevin Smith
> In other words, futures provide synchronisation, while promises > provide resolution. > This is exactly the API that Q (and it's derivatives) use, although the nomenclature is different. In Q, the "future" is called a promise, and the "promise" is what you

Re: Promises

2012-11-07 Thread Alex Russell
ise... but it > has this absurd thing that it has to have both an error and result field > while only one is actually field at any given point. > There are absurdities like this all over DOM for want of promises. A short list must include: - XHR's "readystate" system

Re: Promises

2012-11-07 Thread Andreas Rossberg
On 6 November 2012 20:55, David Herman wrote: > - a way to create promises that don't expose their internal "resolve me" > methods, etc. so they can be delivered to untrusted clients, e.g.: > > var [internalView, externalView] = Promise.makePair(); > &qu

Re: Promises

2012-11-07 Thread Claus Reinke
Home: http://rauschma.de Blog: http://2ality.com On 07.11.2012, at 00:42, "Claus Reinke" wrote: I agree that promises should be standardized in Ecma-262. Agreed. That would also offer the possibility to support promises in syntax. In ES7 (latest), I would like to see somethi

Re: Promises

2012-11-06 Thread Tom Van Cutsem
high priority for ES7. Champions wanted. Alex, I'm calling on > you! I'm happy to assist with a strawman/spec for promises. I too would like to see them standardized. Cheers, Tom ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: Promises

2012-11-06 Thread Domenic Denicola
should cover this, too (right?) Yes, since task.js essentially adds fulfillment and rejection handlers everywhere automatically, it's impossible to be left with an unhandled rejection. (This assumes you use `yield` on all your promises, but then again, if you don't, you are essentially si

Re: Promises

2012-11-06 Thread Axel Rauschmayer
://rauschma.de Blog: http://2ality.com On 07.11.2012, at 00:42, "Claus Reinke" wrote: >> I agree that promises should be standardized in Ecma-262. > > Agreed. That would also offer the possibility to support promises > in syntax. In ES7 (latest), I would like to s

Re: Promises

2012-11-06 Thread Claus Reinke
I agree that promises should be standardized in Ecma-262. Agreed. That would also offer the possibility to support promises in syntax. In ES7 (latest), I would like to see something roughly like { ...; let x <- promise; ...; } (read as "let x from promise"), de

RE: Promises

2012-11-06 Thread Domenic Denicola
As an interesting aside, I just wanted to highlight the section of Promises/A+ that Rick was referring to, because I think it uses a rather clever trick to avoid discussing the event loop while still requiring the behavior we want: "onFulfilled and onRejected must not be called before

Re: Promises

2012-11-06 Thread Mikeal Rogers
having two compatibility modes for IO would not be beneficial to the ecosystem, we can argue that on and on and i'll pull ry out of "retirement" before i concede to it going to in to core :) On Nov 6, 2012, at November 6, 201212:43 PM, Domenic Denicola wrote: > From: es-discuss-boun...@mozill

RE: Promises

2012-11-06 Thread Domenic Denicola
From: es-discuss-boun...@mozilla.org [es-discuss-boun...@mozilla.org] on behalf of Mikeal Rogers [mikeal.rog...@gmail.com] Sent: Tuesday, November 06, 2012 15:33 > also, node.js won't adopt either a promise "API" or a promise syntax for it's > core API. if it lands in the language then nothing i

Re: Promises

2012-11-06 Thread Mikeal Rogers
On Nov 6, 2012, at November 6, 201211:35 AM, Rick Waldron wrote: > Based on a read through of https://github.com/promises-aplus/promises-spec, > these things initially come to mind, please regard as a loose collection of > varying thoughts that may or may not be completely relevan

Re: Promises

2012-11-06 Thread Erik Arvidsson
On Tue, Nov 6, 2012 at 2:55 PM, David Herman wrote: > I agree that promises should be standardized in Ecma-262. Yes. > - a way to create promises that don't expose their internal "resolve me" > methods, etc. so they can be delivered to untrusted clients, e.g.: &

Re: Promises

2012-11-06 Thread David Herman
I agree that promises should be standardized in Ecma-262. There are a number of subtleties that'll need to be hashed out: - the tension between the flexible structural ("duck") type and the desire to have the semantics do different things based on dynamically testing "whet

Re: Promises

2012-11-06 Thread David Bruant
Le 06/11/2012 20:35, Rick Waldron a écrit : Based on a read through of https://github.com/promises-aplus/promises-spec, these things initially come to mind, please regard as a loose collection of varying thoughts that may or may not be completely relevant: 1. The definition of a "promis

Re: Promises

2012-11-06 Thread Rick Waldron
Based on a read through of https://github.com/promises-aplus/promises-spec, these things initially come to mind, please regard as a loose collection of varying thoughts that may or may not be completely relevant: 1. The definition of a "promise" is really just a plain object or functi

Re: Promises

2012-11-06 Thread David Bruant
Le 06/11/2012 20:07, Axel Rauschmayer a écrit : That’s at a weird intersection between HTML5 and ECMAScript, (...) I think it's more historical than anything. The event loop, setTimeout/Interval (and promises) belong to the language (ECMAScript), not to a library (HTML5) in my op

Re: Promises

2012-11-06 Thread Axel Rauschmayer
callbacks (where input and output are clearly separated) and promises when it comes to invocation mechanics It might just be me “not getting it”, but there must be ways to make things more elegant (on both accounts). Axel On Nov 6, 2012, at 19:47 , David Bruant wrote: > Hi, > > In

RE: Promises

2012-11-06 Thread Domenic Denicola
I guess now is a good a time as any to pre-announce Promises/A+: https://github.com/promises-aplus/promises-spec It’s an attempt to improve significantly on the minimal-but-perhaps-too-minimal Promises/A of CommonJS, making the language more rigorous and speccing several important things

Promises

2012-11-06 Thread David Bruant
shelf. Also, the lack of a built-in Q.all really doesn't promote good code when it comes to event synchronization. Oh yes, of course, you can always build a promise library on top of the current APIs, blablabla... and waste battery with these libraries [3]. I'm coming with the following

Re: yield and Promises

2011-10-21 Thread Kris Zyp
On 10/21/2011 11:01 AM, David Herman wrote: [snip] But there's more to it than just the interface. You fix a particular scheduling semantics when you put deferred functions into the language. I'm still learning about the difference between the Deferred pattern and the Promises pa

Re: yield and Promises

2011-10-21 Thread Brendan Eich
On Oct 21, 2011, at 2:03 PM, Eric Jacobs wrote: > As a language end-user, I'm not sure that I would (or should) be concerned > about the distinction between a deep continuation and a chain of shallow > continuations. After all, the stack is just a chain of frames, and the > mechanism by which t

Re: yield and Promises

2011-10-21 Thread Eric Jacobs
Brendan Eich wrote: On Oct 21, 2011, at 12:49 PM, Eric Jacobs wrote: The catch is, of course, that all code which either can yield, or can call other functions which yield, must have the "yield" keyword there, to mark that run-to-completion invariants will end at that point. This seems like a

Re: yield and Promises

2011-10-21 Thread John J Barton
On Fri, Oct 21, 2011 at 10:46 AM, Mark S. Miller wrote: > On Fri, Oct 21, 2011 at 10:20 AM, John J Barton < > johnjbar...@johnjbarton.com> wrote: > >> >> >> In particular, Q simplifies joining parallel async operations (XHR, >> postMessages, 'load', 'progress' events). Of course it may well be th

Re: yield and Promises

2011-10-21 Thread Brendan Eich
On Oct 21, 2011, at 12:49 PM, Eric Jacobs wrote: > The catch is, of course, that all code which either can yield, or can call > other functions which yield, must have the "yield" keyword there, to mark > that run-to-completion invariants will end at that point. This seems like a > very reasonab

Re: yield and Promises

2011-10-21 Thread Eric Jacobs
Jorge wrote: > or some other creative way of statically encoding the "might suspend execution" condition into the syntax? Yes, of course, it would be fine. Why ? Because this is the crux of the "run-to-completion" debate that we're immersed in. Right now, JS has run-to-completion, where com

Re: yield and Promises

2011-10-21 Thread Jorge
On 21/10/2011, at 21:23, Dean Landolt wrote: > On Fri, Oct 21, 2011 at 3:20 PM, Jorge > On 21/10/2011, at 17:40, Eric Jacobs wrote: >>> >>> Jorge, >>> >>> Would it still be satisfying to you if instead of writing the call >>> expression like this: >>> try { >>>response = asyncFunction(req

Re: yield and Promises

2011-10-21 Thread Dean Landolt
On Fri, Oct 21, 2011 at 3:20 PM, Jorge wrote: > On 21/10/2011, at 17:40, Eric Jacobs wrote: > > > Jorge, > > > > Would it still be satisfying to you if instead of writing the call > expression like this: > >> try { > >> response = asyncFunction(request); //might suspend execution > >> } > >> ca

Re: yield and Promises

2011-10-21 Thread Jorge
On 21/10/2011, at 17:40, Eric Jacobs wrote: > Jorge, > > Would it still be satisfying to you if instead of writing the call expression > like this: >> try { >> response = asyncFunction(request); //might suspend execution >> } >> catch (e) { >> //whatever >> } >> //our code continues here > w

Re: yield and Promises

2011-10-21 Thread Brendan Eich
On Oct 21, 2011, at 10:20 AM, John J Barton wrote: > My comment is entirely subjective and intended to be positive about Q. We like Q too. :-) > The examples on the async-generators page cites above are clearer than the > ones on the MDC generators page because they focus on "next()". The stro

Re: yield and Promises

2011-10-21 Thread Mark S. Miller
On Fri, Oct 21, 2011 at 10:20 AM, John J Barton wrote: > > > On Fri, Oct 21, 2011 at 9:41 AM, Brendan Eich wrote: > >> On Oct 21, 2011, at 9:34 AM, John J Barton wrote: >> >> Can anyone summarize how these proposals relate to Kris Kowal / Kris Zyp / >> Mark Miller Q library: >> https://github.co

Re: yield and Promises

2011-10-21 Thread John J Barton
On Fri, Oct 21, 2011 at 9:41 AM, Brendan Eich wrote: > On Oct 21, 2011, at 9:34 AM, John J Barton wrote: > > Can anyone summarize how these proposals relate to Kris Kowal / Kris Zyp / > Mark Miller Q library: > https://github.com/kriskowal/q > > > Did you see > https://github.com/kriskowal/q/tree

Re: yield and Promises

2011-10-21 Thread David Herman
ous code in direct style. And I agree with you and Alex and Arv that there is a cost to not standardizing on those libraries. There are different frameworks with similar but incompatible idioms for Deferred objects, Promises, and the like, and they could be standardized. > A couple years later,

Re: yield and Promises

2011-10-21 Thread Brendan Eich
On Oct 21, 2011, at 9:34 AM, John J Barton wrote: > Can anyone summarize how these proposals relate to Kris Kowal / Kris Zyp / > Mark Miller Q library: > https://github.com/kriskowal/q Did you see https://github.com/kriskowal/q/tree/master/examples/async-generators yet? > In my experience, re

Re: yield and Promises

2011-10-21 Thread John J Barton
Can anyone summarize how these proposals relate to Kris Kowal / Kris Zyp / Mark Miller Q library: https://github.com/kriskowal/q In my experience, reasoning about the code was much easier with Q than without Q. (Not something I found in trying generators). I found the documentation hard to follo

Re: yield and Promises

2011-10-21 Thread Eric Jacobs
Jorge, Would it still be satisfying to you if instead of writing the call expression like this: > try { >response = asyncFunction(request); //might suspend execution > } > catch (e) { >//whatever > } > //our code continues here we needed to write it with an explicit annotation, like this

Re: yield and Promises

2011-10-21 Thread David Herman
You can disagree with anything if you're allowed to change the terms of the discussion. :) Brendan said JS is run-to-completion, which means that if you call a function and control returns to you, no intervening threads of control have executed in the meantime. But then you changed his example

Re: yield and Promises

2011-10-21 Thread Jorge
On 21/10/2011, at 11:07, Jorge wrote: > > And this has several (valuable, imo) advantages: > > - We aren't trashing the call stack on every async call: we can finally debug > properly! > - We can (finally!) catch the exceptions where and when it matters. > - We can loop and control flow in the u

Re: yield and Promises

2011-10-21 Thread Jorge
On 20/10/2011, at 23:37, Brendan Eich wrote: > On Oct 20, 2011, at 12:59 PM, Jorge wrote: > >> the assert_invariants() at the next line might run in another turn of the >> event loop (when f() resumes), just as the callback does. > > No. Nothing in JS today, since it lacks coroutines or call/cc,

Re: yield and Promises

2011-10-20 Thread Brendan Eich
On Oct 20, 2011, at 12:59 PM, Jorge wrote: >>> assert_invariants(); >>> f(); //might suspend execution >>> assert_invariants(); // perhaps yes, perhaps no. There's no guarantee >>> either. >>> return; (Please trim cited text -- I know gmail hides it, which is a bug, but most mail user agents sh

Re: yield and Promises

2011-10-20 Thread Jorge
On 20/10/2011, at 18:38, Brendan Eich wrote: > On Oct 20, 2011, at 6:44 AM, Jorge wrote: >> On 19/10/2011, at 23:34, Brendan Eich wrote: >>> >>> The other objection is that (ignoring some evil native APIs such as sync >>> XHR) JS has run-to-completion execution model now. You can model >>> >>> a

Re: yield and Promises

2011-10-20 Thread Brendan Eich
On Oct 20, 2011, at 6:44 AM, Jorge wrote: > On 19/10/2011, at 23:34, Brendan Eich wrote: >> >> The other objection is that (ignoring some evil native APIs such as sync >> XHR) JS has run-to-completion execution model now. You can model >> >> assert_invariants(); >> f(); >> assert_invariants_not

Re: yield and Promises

2011-10-20 Thread Dean Landolt
On Thu, Oct 20, 2011 at 9:44 AM, Jorge wrote: > On 19/10/2011, at 23:34, Brendan Eich wrote: > > > > The other objection is that (ignoring some evil native APIs such as sync > XHR) JS has run-to-completion execution model now. You can model > > > > assert_invariants(); > > f(); > > assert_inva

Re: yield and Promises

2011-10-20 Thread Jorge
On 19/10/2011, at 23:34, Brendan Eich wrote: > > The other objection is that (ignoring some evil native APIs such as sync XHR) > JS has run-to-completion execution model now. You can model > > assert_invariants(); > f(); > assert_invariants_not_affected_by_f_etc(); > > where "etc" means func

Re: yield and Promises

2011-10-19 Thread Brendan Eich
On Oct 19, 2011, at 2:34 PM, Brendan Eich wrote: > The other objection is that (ignoring some evil native APIs such as sync XHR) > JS has run-to-completion execution model now. You can model > > assert_invariants(); > f(); > assert_invariants_not_affected_by_f_etc(); Contrast with generators

Re: yield and Promises

2011-10-19 Thread Brendan Eich
ulfill the most wanted use cases > seems like than ideal. Yeah, batteries included languages such as Python win. We aspire to that. But apart from your (or anyone else's) proposal, JS is not Python in particular ways that make it hard to rush OOTB built-ins to do promises or deferred func

Re: yield and Promises

2011-10-19 Thread Brendan Eich
On Oct 19, 2011, at 12:55 PM, Eric Jacobs wrote: > Kris Zyp wrote: >> I believe that the overwhelming need that is continually and >> constantly expressed and felt in the JS community in terms of handling >> asynchronous activity is fundamentally a cry for top-down controlled >> single-frame co

Re: yield and Promises

2011-10-19 Thread Kris Zyp
} } } IIUC you're proposing language-level support for promises, right? There's no getting around it -- you're spec'ing an interface for the unary yield operator to interact with. So why not go all out and have the language stratify `then` for you

Re: yield and Promises

2011-10-19 Thread Eric Jacobs
Kris Zyp wrote: > I believe that the overwhelming need that is continually and > constantly expressed and felt in the JS community in terms of handling > asynchronous activity is fundamentally a cry for top-down controlled > single-frame continuations (obviously not always stated in such terms,

Re: yield and Promises

2011-10-19 Thread Dean Landolt
the value is not an object with a "then" property that is a function, > the operand value is the immediate result of the evaluation of the "yield" > expression and execution is not suspended. > > Here is a simple example of usage: > "use strict" > func

yield and Promises

2011-10-19 Thread Kris Zyp
ant commonality. Using one keyword means there is only a single operator that can result in a suspension of execution within a function body, making easier to spot such occurrences and look for possible points where certain variants should not be anticipated. Of course it is also nice to avo

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-02-01 Thread Irakli Gozalishvili
fork of Kris's q-comm where I prototyped de-sugared implementation of this proposal for Mozilla Jetpack, where it will allow cross process async messaging. https://github.com/Gozala/vats > >> >> I do believe that having ES native promises could provide drastically >> bet

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-30 Thread Mark S. Miller
On Fri, Jan 28, 2011 at 9:54 PM, Kam Kasravi wrote: > > Does this have some parallels with channel messaging ( > http://www.w3.org/TR/html5/comms.html#channel-messaging)? > On Sat, Jan 29, 2011 at 7:17 AM, Kris Zyp wrote: > > So Web Workers are the competition? You can build far references on

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-29 Thread Kris Zyp
cs, this may just use event-loop stacking to "wait" or yield. > > However, I think your comparisons show your missing the point of this > strawman. AFAIK, all the systems you cite, including node-promise > which implements CommonJS promises/A and your proposed use of s

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-28 Thread Kam Kasravi
experience is good. > > However, I think your comparisons show your missing the point of this > strawman. AFAIK, all the systems you cite, including node-promise which > implements CommonJS promises/A and your proposed use of shallow > continuations, are all only for helping expre

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-28 Thread Mark S. Miller
d look up the address if > desired. > Please do. More collective experience is good. However, I think your comparisons show your missing the point of this strawman. AFAIK, all the systems you cite, including node-promise which implements CommonJS promises/A and your proposed use of shallow c

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-28 Thread Kris Zyp
come the dominate interface API, there are other approaches that > have been found more use. While I certainly like and appreciate > the Q API, I don't think it has proven itself worthy to be added > to the language. > > The real pain point with promises isn't that i

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-27 Thread Mike Shaver
On Thu, Jan 27, 2011 at 9:37 PM, Mark S. Miller wrote: > I don't understand why single-frame continuations are not at least as > vulnerable to the criticism you make above. They are even more unproven > among JavaScript programmers than are the concurrency abstractions in the > strawman. The main

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-27 Thread Mark S. Miller
on't think it has > proven itself worthy to be added to the language. > > The real pain point with promises isn't that it takes too many characters > to type Q.post. How many bytes does the average JavaScript program spend on > promise API calls? It negligible, this prop

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-27 Thread Kris Zyp
discussed and known about for a number of years has not become the dominate interface API, there are other approaches that have been found more use. While I certainly like and appreciate the Q API, I don't think it has proven itself worthy to be added to the language. The real pain point with pro

Re: promises | Communicating Event-Loop Concurrency and Distribution

2011-01-27 Thread Mark S. Miller
m of the strawman page.) > > > I do believe that having ES native promises could provide drastically > better alternative for writing async code in comparison to currently popular > nested callback style. Also even though there are few implementations of Q > API adoption is sti

promises | Communicating Event-Loop Concurrency and Distribution

2011-01-27 Thread Irakli Gozalishvili
Hi, I was curious to know what is the state of the following proposal: http://wiki.ecmascript.org/doku.php?id=strawman:concurrency I do believe that having ES native promises could provide drastically better alternative for writing async code in comparison to currently popular nested callback

Re: instanceof trap - Useful to implement promises through proxies

2010-11-22 Thread Tom Van Cutsem
Ok, I see. So it's true that the current Proxy API doesn't support promises that would throw on instanceof when unresolved and return a boolean when resolved. The main reason is that we didn't want proxies to meddle with the inheritance chain, in particular giving proxies the abili

Re: instanceof trap - Useful to implement promises through proxies

2010-11-19 Thread Sebastian Markbåge
s to be delayed. Not prototype of Cat. It may be resolved to any number of different prototype chains depending on how the future/promise is resolved. Sebastian On Fri, Nov 19, 2010 at 4:38 PM, Tom Van Cutsem wrote: > Hi Sebastian, > > Could you clarify why trapping instanceof is req

Re: instanceof trap - Useful to implement promises through proxies

2010-11-19 Thread Tom Van Cutsem
Hi Sebastian, Could you clarify why trapping instanceof is required for promises? It seems your use case can be addressed already using the current Proxy API: if `FP` is a function proxy, then `obj instanceof FP` will query `FP` for its `prototype` property (as per the default algorithm) by

instanceof trap - Useful to implement promises through proxies

2010-11-18 Thread Sebastian Markbåge
I thought I'd make the case for the "instanceof trap" in strawman:proxy_extensions - beyond multiple inheritance. I'm sure this point has been made before at some point. This is useful to implement various forms of promises using proxies. The prototype can be resolved at

Re: Dataflow concurrency and promises

2009-09-29 Thread Kris Zyp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Just FYI, there has also been significant discussion on CommonJS regarding the use promises [1] and concurrency [2] in JavaScript, CommonJS is focused on standardizing library APIs for JavaScript, in particular on the server. Obviously on the server

Dataflow concurrency and promises

2009-09-29 Thread David-Sarah Hopwood
, we're looking at Promises (precedent from E) and Futures > (differently, in MultiLisp and Alice-ML). At least one contributor on > es-discuss has advocated lower-level components such as dataflow variables. That was presumably me: <https://mail.mozilla.org/pipermail/es5-discuss/2

<    1   2   3   4