Re: Promise.cast and Promise.resolve

2014-02-19 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 11:38 PM, C. Scott Ananian wrote: [resending to list, original was sent from wrong address and got bounced] On Tue, Feb 18, 2014 at 11:12 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 18, 2014, at 12:44 PM, C. Scott Ananian wrote: ```js var SubPromise =

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Yehuda Katz
On Sat, Feb 15, 2014 at 5:17 AM, Anne van Kesteren ann...@annevk.nl wrote: On Fri, Feb 14, 2014 at 10:50 PM, C. Scott Ananian ecmascr...@cscott.net wrote: Since both Chrome and FIrefox have plans to support Promises, feel free to suggest any changes to `es6-shim` which would improve

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Andreas Rossberg
On 18 February 2014 10:43, Yehuda Katz wyc...@gmail.com wrote: On Sat, Feb 15, 2014 at 5:17 AM, Anne van Kesteren ann...@annevk.nl wrote: On Fri, Feb 14, 2014 at 10:50 PM, C. Scott Ananian ecmascr...@cscott.net wrote: Since both Chrome and FIrefox have plans to support Promises, feel free

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Mark S. Miller
On Tue, Feb 18, 2014 at 10:29 AM, C. Scott Ananian csc...@cscott.netwrote: Yes, and I'm pointing out that you can subclass built-ins in a compatible manner even without the @@create hook, How? and hoping that we might see support for that (for Promises at least; maybe Map/Set as well).

RE: Promise.cast and Promise.resolve

2014-02-18 Thread Domenic Denicola
You can do so in the manner you were always able to in ES5, and you were able to do in ES6 before the introduction of @@create. However, what this means is that you now allow parastic inheritance again, which @@create was created to disallow. That is, you could have a MapPromiseWeakMap just by

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 10:39 AM, Domenic Denicola wrote: You can do so in the manner you were always able to in ES5, and you were able to do in ES6 before the introduction of @@create. However, what this means is that you now allow parastic inheritance again, which @@create was created to

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Mark S. Miller
Yes. For these same reasons, Date.call(obj) already doesn't work in ES5. On Tue, Feb 18, 2014 at 10:54 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Feb 18, 2014, at 10:39 AM, Domenic Denicola wrote: You can do so in the manner you were always able to in ES5, and you were able to

RE: Promise.cast and Promise.resolve

2014-02-18 Thread Domenic Denicola
From: Allen Wirfs-Brock al...@wirfs-brock.com No, even if you removed the checks in Map and Promise and WeakMap that prevent them from trying to initialize an object that lacks the appropriate internal slots it still wouldn't work because obj does not have the internal slots necessary to

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Brendan Eich
Domenic Denicola wrote: Well, but you could just move the internal slot initialization into the constructor itself (as Scott has done in his es6-shim promises). Unlike e.g. `Array`, the objects returned by `Promise[@@create]` are not exotic objects; they are simply normal objects with some

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Mark S. Miller
The same rationale would apply to Date, but making this change for Date would be a breaking change. For consistency, let's not pick and choose among builtins this way. We'll have @@create soon enough. On Tue, Feb 18, 2014 at 11:09 AM, Domenic Denicola dome...@domenicdenicola.com wrote: From:

RE: Promise.cast and Promise.resolve

2014-02-18 Thread Domenic Denicola
is what they want to do in the meantime. From: Mark S. Miller erig...@google.com Sent: Tuesday, February 18, 2014 14:16 To: Domenic Denicola Cc: Allen Wirfs-Brock; C. Scott Ananian; Brendan Eich; Yutaka Hirano; es-discuss@mozilla.org list Subject: Re: Promise.cast

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 11:09 AM, Domenic Denicola wrote: From: Allen Wirfs-Brock al...@wirfs-brock.com No, even if you removed the checks in Map and Promise and WeakMap that prevent them from trying to initialize an object that lacks the appropriate internal slots it still wouldn't work

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Mark S. Miller
On Tue, Feb 18, 2014 at 11:23 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Feb 18, 2014, at 11:09 AM, Domenic Denicola wrote: From: Allen Wirfs-Brock al...@wirfs-brock.com No, even if you removed the checks in Map and Promise and WeakMap that prevent them from trying to

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 12:44 PM, C. Scott Ananian wrote: ps. I'm talking about this pattern in particular: ```js var SubPromise = function(exec) { Promise.call(this, exec); ... }; Object.setPrototypeOf(SubPromise, Promise); SubPromise.prototype = Object.create(Promise.prototype);

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Boris Zbarsky
On 2/18/14 2:51 PM, Allen Wirfs-Brock wrote: I'm also a bit concerned, that there may be a meme starting that it will be a looong time (years, if ever) before @@create is actually implemented so JS developers really shouldn't count on being able to use it if the foreseeable future. Such a

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 1:12 PM, Boris Zbarsky wrote: On 2/18/14 2:51 PM, Allen Wirfs-Brock wrote: I'm also a bit concerned, that there may be a meme starting that it will be a looong time (years, if ever) before @@create is actually implemented so JS developers really shouldn't count on

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Boris Zbarsky
On 2/18/14 4:34 PM, Allen Wirfs-Brock wrote: In that case, i don't see why the DOM is a barrier to adding @@create to JS. It's not, and I'm not quite sure where you thought I said it was I was talking about actual uses of subclassing for DOM objects. Maybe we should make DOM

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 1:49 PM, Boris Zbarsky wrote: On 2/18/14 4:34 PM, Allen Wirfs-Brock wrote: You don't necessary need a new slot to to use as an initialized flag. I most cases you can probably get away with using a not yet initialized token in some existing slot. While true, doing

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Jason Orendorff
On Tue, Feb 18, 2014 at 3:34 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Of course adding an extra internal slot to all DOM objects is not necessarily all that great either... Though maybe we have to do that no matter what to prevent double-initialization. You don't necessary need a

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 4:59 PM, Jason Orendorff wrote: On Tue, Feb 18, 2014 at 3:34 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Of course adding an extra internal slot to all DOM objects is not necessarily all that great either... Though maybe we have to do that no matter what to

Re: Promise.cast and Promise.resolve

2014-02-18 Thread Boris Zbarsky
On 2/18/14 4:57 PM, Allen Wirfs-Brock wrote: I think that could be handled generically in the WebIDL spec. You can specify it as if there was a per object initialized flag. But how that state is actually represented can be left to actual implementations to deal with. Yeah, agreed. I came

Re: Promise.cast and Promise.resolve

2014-02-18 Thread C. Scott Ananian
[resending to list, original was sent from wrong address and got bounced] On Tue, Feb 18, 2014 at 11:12 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 18, 2014, at 12:44 PM, C. Scott Ananian wrote: ```js var SubPromise = function(exec) { Promise.call(this, exec); ... };

Re: Promise.cast and Promise.resolve

2014-02-16 Thread C. Scott Ananian
On Sat, Feb 15, 2014 at 3:17 AM, Anne van Kesteren ann...@annevk.nl wrote: It will take a long time before browsers support subclassing in general as far as I can tell. I'm not talking about the class system in general. I'm talking about the ES5+ code: ```js Promise.prototype.bind =

Re: Promise.cast and Promise.resolve

2014-02-15 Thread Anne van Kesteren
On Fri, Feb 14, 2014 at 10:50 PM, C. Scott Ananian ecmascr...@cscott.net wrote: Since both Chrome and FIrefox have plans to support Promises, feel free to suggest any changes to `es6-shim` which would improve compatibility. It looks like that at the moment the `es6-shim` implementation is

Re: Promise.cast and Promise.resolve

2014-02-14 Thread Anne van Kesteren
On Fri, Feb 7, 2014 at 11:50 AM, Anne van Kesteren ann...@annevk.nl wrote: I filed https://bugzilla.mozilla.org/show_bug.cgi?id=966348 on Gecko when the news broke. Mozilla can probably still make things in order before promises hit stable. To be clear, we fixed this. And we will be going

Re: Promise.cast and Promise.resolve

2014-02-14 Thread C. Scott Ananian
On Fri, Feb 14, 2014 at 6:21 AM, Anne van Kesteren ann...@annevk.nl wrote: To be clear, we fixed this. And we will be going ahead and shipping promises in Firefox 29. Too many dependencies at this point to hold of longer. Since both Chrome and FIrefox have plans to support Promises, feel free

RE: Promise.cast and Promise.resolve

2014-02-11 Thread Jonathan Bond-Caron
On Sun Feb 9 07:30 PM, Brendan Eich wrote: Jonathan Bond-Caron wrote: Thoughts on adding options/flags Just say no. http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html This is a symptom. We are resisting the larger issue of do both or design-by- committee unioning

RE: Promise.cast and Promise.resolve

2014-02-09 Thread Jonathan Bond-Caron
On Fri Feb 7 12:14 PM, Tab Atkins Jr. wrote: From a user perspective, can someone explain what chain() does? .chain returns what is directly inside the promise, without doing any additional magic. This is different from .then, which flattens promises. For a more concrete example,

Re: Promise.cast and Promise.resolve

2014-02-08 Thread Quildreen Motta
16:05:20 -0500 Subject: Re: Promise.cast and Promise.resolve A *working* implementation should be created and solutions to real-world use cases should be programmed using the design before any spec language is authored. Spec-language is apoor medium for communicating both design intent

Re: Promise.cast and Promise.resolve

2014-02-08 Thread Benjamin (Inglor) Gruenbaum
On Sat, Feb 8, 2014 at 2:57 PM, Quildreen Motta quildr...@gmail.com wrote: Well, promises are a fairly old concept, with several different implementations throughout the history of CompSci, and even in JavaScript land itself. `.chain` itself is not common because it doesn't need to have

Re: Promise.cast and Promise.resolve

2014-02-08 Thread Quildreen Motta
On 8 February 2014 12:26, Benjamin (Inglor) Gruenbaum ing...@gmail.comwrote: On Sat, Feb 8, 2014 at 2:57 PM, Quildreen Motta quildr...@gmail.comwrote: One of the problems with just following existing solutions is that you'd also be copying the evolution mistakes and technical debts in those

Re: Promise.cast and Promise.resolve

2014-02-08 Thread Kevin Smith
Sounds both good in principle, and bad like waterfall. Waterfall is dead. Strike the waterfall part. Still, we end up with three artifacts: a design goals document, a prototype, and a spec. The design goals should be the first to stabilize, the spec should be the last. Would such goals

Re: Promise.cast and Promise.resolve

2014-02-08 Thread John Barton
On Sat, Feb 8, 2014 at 8:11 AM, Kevin Smith zenpars...@gmail.com wrote: Sounds both good in principle, and bad like waterfall. Waterfall is dead. Strike the waterfall part. Still, we end up with three artifacts: a design goals document, a prototype, and a spec. The design goals should be

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Yutaka Hirano
Resolving this would be much appreciated. Gecko recently turned on Promises in our nightly builds, and already branched to our aurora builds. I believe Chrome is in a similar situation. Chrome has shipped Promises, i.e. they are enabled by default on the current stable Chrome. So the

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Anne van Kesteren
On Fri, Feb 7, 2014 at 12:45 PM, Yutaka Hirano yhir...@chromium.org wrote: Sorry for knowing little about ES consensus, is this the final decision? Will you change it again? Yeah, some clarity would be nice. I filed https://bugzilla.mozilla.org/show_bug.cgi?id=966348 on Gecko when the news

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Andreas Rossberg
On 5 February 2014 11:17, Mark S. Miller erig...@google.com wrote: At the end of Sept mtg, my memory of the state on entry to the meeting agrees completely with Domenic's. On exit, my memory is a) We had agreed to promote both the .then level and the .chain level to ES6. (This is probably the

Re: async decision making (was Re: Promise.cast and Promise.resolve)

2014-02-07 Thread Andreas Rossberg
On 5 February 2014 12:10, Alex Russell slightly...@google.com wrote: On Wed, Feb 5, 2014 at 12:00 PM, Brendan Eich bren...@mozilla.com wrote: I'd rather we keep separate and conflict-prone APIs in separate objects, though. I'd rather we acknowledge that Promises are a library de-facto

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Kevin Smith
However, this question actually triggered me to have a closer look at the state of the spec (again), the outcome of which was my proposal for a refactoring. That refactoring based .then on .chain and pulled it from any of the core logic, thus avoiding the problems you seem to be alluding

RE: Promise.cast and Promise.resolve

2014-02-07 Thread Jonathan Bond-Caron
On Fri Feb 7 06:50 AM, Anne van Kesteren wrote: On Fri, Feb 7, 2014 at 12:45 PM, Yutaka Hirano yhir...@chromium.org wrote: Sorry for knowing little about ES consensus, is this the final decision? Will you change it again? Yeah, some clarity would be nice. From a user perspective, can

RE: Promise.cast and Promise.resolve

2014-02-07 Thread Domenic Denicola
From: es-discuss es-discuss-boun...@mozilla.org on behalf of Jonathan Bond-Caron jbo...@gdesolutions.com What seems like a preferred api / pattern from an ecma PoV to serially execute promises? Promise.prototype.then https://github.com/kriskowal/q#sequences

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Tab Atkins Jr.
On Fri, Feb 7, 2014 at 8:20 AM, Jonathan Bond-Caron jbo...@gdesolutions.com wrote: On Fri Feb 7 06:50 AM, Anne van Kesteren wrote: On Fri, Feb 7, 2014 at 12:45 PM, Yutaka Hirano yhir...@chromium.org wrote: Sorry for knowing little about ES consensus, is this the final decision? Will you

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Brendan Eich
Kevin Smith wrote: If I may interject some opinions on process... Sure, it's es-discuss. Plus, you've earned your spurs. I'm not sure how this fits in with the new post-ES6 process, but from this one outsider's point of view: - A formal set of design goals should be completed and agreed

Re: Promise.cast and Promise.resolve

2014-02-07 Thread David Bruant
Le 07/02/2014 22:05, Brendan Eich a écrit : Kevin Smith wrote: - A *working* implementation should be created and solutions to real-world use cases should be programmed using the design before any spec language is authored. Spec-language is a poor medium for communicating both design intent

Re: Promise.cast and Promise.resolve

2014-02-07 Thread Brendan Eich
David Bruant wrote: Le 07/02/2014 22:05, Brendan Eich a écrit : Kevin Smith wrote: - A *working* implementation should be created and solutions to real-world use cases should be programmed using the design before any spec language is authored. Spec-language is a poor medium for

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Kevin Smith
- Promise.cast is renamed to Promise.resolve (remove old Promise.resolve) - Keep then, reject chain (NOT DEFER, reject!) - Renaming .cast thus removes over-wrapping (always-wrap) deoptimization in old Promise.resolve So basically, since September, we've seen: - A design proposal which

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Paolo Amadini
On 05/02/2014 9.43, Brendan Eich wrote: Can we regain consensus on the September status quo ante, minus any do both half-hearted compromises that don't work? Mark, what do you think? For what it's worth, I've been planning to file a bug on GitHub before I saw the most recent conclusion, that

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Mark S. Miller
On Wed, Feb 5, 2014 at 12:43 AM, Brendan Eich bren...@mozilla.com wrote: Kevin Smith wrote: - Promise.cast is renamed to Promise.resolve (remove old Promise.resolve) - Keep then, reject chain (NOT DEFER, reject!) - Renaming .cast thus removes over-wrapping (always-wrap)

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Mark S. Miller
On Wed, Feb 5, 2014 at 6:37 AM, Mark S. Miller erig...@google.com wrote: On Wed, Feb 5, 2014 at 12:43 AM, Brendan Eich bren...@mozilla.com wrote: Kevin Smith wrote: - Promise.cast is renamed to Promise.resolve (remove old Promise.resolve) - Keep then, reject chain (NOT DEFER,

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Quildreen Motta
I can understand the you can't have your cake and eat it too sentiment. Indeed, I do think that having `.then()` and `.chain()` in the spec is a mistake. The only thing that saddens me (and this also with some other parts of the spec, such as Object.create) is that `.then()` is not an orthogonal

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Andreas Rossberg
I really regret that I couldn't be there on the last day of the meeting, and share the frustration I hear in this thread. I honestly have a hard time viewing this as a consensus, if for nothing else than that I do not consent. :) For the record, let me repeat what I wrote in a private

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Brendan Eich
Quildreen Motta wrote: but as with other parts of JavaScript, the simpler, orthogonal primitives are not available for users to derive more complex functionality from easily. So true. JS is like a mini-toolkit of three-tool Swiss Army Knife (functions) with constructor and closure tools as

RE: Promise.cast and Promise.resolve

2014-02-05 Thread Ron Buckton
the specialized case. Best regards, Ron -Original Message- From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan Eich Sent: Wednesday, February 5, 2014 7:46 AM To: Quildreen Motta Cc: Mark S. Miller; EcmaScript Subject: Re: Promise.cast and Promise.resolve

RE: Promise.cast and Promise.resolve

2014-02-05 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan Eich Kevin Smith wrote: So basically, since September, we've seen: - A design proposal which achieved consensus - A spec implementation which completely ignored that consensus - And now a third design, which also

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Brendan Eich
Domenic Denicola wrote: The amount of heat Kevin has piled on to promises-unwrapping, repeatedly, has been puzzling and unwarranted, but I have chosen mostly to set it aside, as the words of someone who did not care to understand the whole history and design constraints involved in writing

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Andreas Rossberg
On 5 February 2014 18:35, Domenic Denicola dome...@domenicdenicola.com wrote: The evolution of DOM and ES promises, and the related fragile consensuses, has been an involved process. Going back to the source documents, consider what the May AP2 proto-consensus really is: Abashed Monadic

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Sam Tobin-Hochstadt
On Wed, Feb 5, 2014 at 1:34 PM, Andreas Rossberg rossb...@google.com wrote: On 5 February 2014 18:35, Domenic Denicola dome...@domenicdenicola.com wrote: The evolution of DOM and ES promises, and the related fragile consensuses, has been an involved process. Going back to the source

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Tab Atkins Jr.
On Wed, Feb 5, 2014 at 11:17 AM, Mark S. Miller erig...@google.com wrote: Unfortunately, just as Yehuda was not there in September and did not agree to the consensus then, Andreas was not there on Thursday of January and (above in this thread) does not agree to that consensus. This indicates a

async decision making (was Re: Promise.cast and Promise.resolve)

2014-02-05 Thread Edward O'Connor
Hi, Mark wrote: Unfortunately, just as Yehuda was not there in September and did not agree to the consensus then, Andreas was not there on Thursday of January and (above in this thread) does not agree to that consensus. This indicates a different failure mode we should be concerned about.

Re: async decision making (was Re: Promise.cast and Promise.resolve)

2014-02-05 Thread Brendan Eich
Edward O'Connor wrote: Perhaps TC39 should consider adopting a similar policy. Policy, schmolicy :-P. (Presumably clocks with deadlines are required; consensus could break afterwards, in spite of the formal rules.) Let's let our hair down a bit and get real here. We did not declare

Re: async decision making (was Re: Promise.cast and Promise.resolve)

2014-02-05 Thread Alex Russell
On Wed, Feb 5, 2014 at 12:00 PM, Brendan Eich bren...@mozilla.com wrote: Edward O'Connor wrote: Perhaps TC39 should consider adopting a similar policy. Policy, schmolicy :-P. (Presumably clocks with deadlines are required; consensus could break afterwards, in spite of the formal rules.)

Re: async decision making (was Re: Promise.cast and Promise.resolve)

2014-02-05 Thread Brendan Eich
Alex Russell wrote: I'd rather we keep separate and conflict-prone APIs in separate objects, though. I'd rather we acknowledge that Promises are a library de-facto quasi-standard we are trying to codify, not green-field work where we can start over or do both. Excited to hear

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Brendan Eich
Tab Atkins Jr. wrote: Note, though, that you can still have consensus*and* strong objections. Design-by-committee is still a failure mode to be avoided. Excellent point. Argues against do both. Can't ditch .then/resolve given library code interop constraint. That forces the conclusion from

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Tab Atkins Jr.
On Wed, Feb 5, 2014 at 12:17 PM, Brendan Eich bren...@mozilla.com wrote: Tab Atkins Jr. wrote: Note, though, that you can still have consensus*and* strong objections. Design-by-committee is still a failure mode to be avoided. Excellent point. Argues against do both. Can't ditch

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Brendan Eich
Tab Atkins Jr. wrote: (Fixing it does involve magic, or subclassing, but those are things that can be done internally, rather than exposed to authors as terrible API.) Could you say a bit more? Do you mean APIs that defensively hand-box so the user doesn't have to, with async map and its

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Tab Atkins Jr.
On Wed, Feb 5, 2014 at 12:34 PM, Brendan Eich bren...@mozilla.com wrote: Tab Atkins Jr. wrote: (Fixing it does involve magic, or subclassing, but those are things that can be done internally, rather than exposed to authors as terrible API.) Could you say a bit more? Do you mean APIs that

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Brendan Eich
Tab Atkins Jr. wrote: The APIs for Caches and dealing with responses are designed so that they work nicely together, acting the same way whether you pass a Response or a PromiseResponse. So you can often respond to requests with a simple e.respondWith(cache.get('foo')) and it Just Works®.

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Tab Atkins Jr.
On Wed, Feb 5, 2014 at 3:51 PM, Brendan Eich bren...@mozilla.com wrote: Tab Atkins Jr. wrote: But say you wanted to do something a bit more complicated. For example, if the cache hits, but the result is a Promise, you might want to show a throbber until the Promise resolves. Under the old

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Mark S. Miller
Just noting that with the infix ! syntax proposed for ES7, this would be e.respondWith(cache.get('foo') ! [0]) On Wed, Feb 5, 2014 at 4:44 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Wed, Feb 5, 2014 at 3:51 PM, Brendan Eich bren...@mozilla.com wrote: Tab Atkins Jr. wrote: But say

Re: Promise.cast and Promise.resolve

2014-02-05 Thread Kevin Smith
I really don't know what to do about this. A few facts: - Promises have a long history of controversy (I was there on the CommonJS list!) - The AP2 design was found acceptable (if not ideal) to all parties, providing us with a path through the controversy - Promises were a *very* late

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Rick Waldron
On Tue, Feb 4, 2014 at 11:53 AM, Jonas Sicking jo...@sicking.cc wrote: On Wed, Jan 29, 2014 at 7:33 AM, Kevin Smith zenpars...@gmail.com wrote: It is, actually, more simplicity. The concept of `Promise.resolve` and `Promise.chain` is simpler than `Promise.cast` and `Promise.then` (i.e.:

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Tab Atkins Jr.
On Tue, Feb 4, 2014 at 10:55 AM, Rick Waldron waldron.r...@gmail.com wrote: Per Resolution (https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-01/jan-30.md#conclusionresolution-3) - Promise.cast is renamed to Promise.resolve (remove old Promise.resolve) - Keep then, reject chain (NOT

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
Tab Atkins Jr. wrote: On Tue, Feb 4, 2014 at 10:55 AM, Rick Waldronwaldron.r...@gmail.com wrote: Per Resolution (https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-01/jan-30.md#conclusionresolution-3) - Promise.cast is renamed to Promise.resolve (remove old Promise.resolve)

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Gorgi Kosev
Not sure if this is correct, but: This might actually be (perhaps accidentally) one step closer to allowing promises for thenables in a cleaner way *if* the need arises in the future. Since its impossible to create a promise for a promise now, it would be *theoretically* possible (at some point

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Gorgi Kosev
Whoops, maybe scratch the monadic part - it would still be impossible to create a promise for a promise. It would however be possible to protect thenables. On Wed, Feb 5, 2014 at 2:17 AM, Gorgi Kosev gorgi.ko...@gmail.com wrote: Not sure if this is correct, but: This might actually be (perhaps

RE: Promise.cast and Promise.resolve

2014-02-04 Thread mfowle
1. Committee do both / union proposals smell and bloat -- this is a problem _per se_. Irony: .then() does both things and there's no way to stop it from doing both. The do both committee is actually not wanting both, it wants to only do one thing. We insist, we demand on having a way to NOT do

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
mfo...@eldergods.com wrote: #3 is the only point I concede as being even possibly concrete Then you get a *plonk*, or at least a demeric, for ignoring the very concrete problem #2: combinators such as .all do not use .chain, they use .then. Also for ignoring #1 -- it doesn't matter that

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
Brendan Eich mailto:bren...@mozilla.com February 4, 2014 at 7:46 PM Then you get a *plonk*, or at least a demeric, demerit', of course. But I'm talking to a fake address. That's pretty bad, it makes me want to ignore you (*plonk* in USENET terms). Do better quickly, or else that's the

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Mark Roberts
Wanting something value-ish, featureless, monadic, is a good goal for a differently named abstraction built on value objects. Promises are not that abstraction. Do the work to show the win, under a new name (Future?). I believe the win has already been shown, though: Futures would of course

Re: Promise.cast and Promise.resolve

2014-02-04 Thread mfowle
I like your looking forwards to the future Future, but I really want to understand the conflict underneath Promises. I'm not trying to selectively pick issues out, I'm trying to get a general sense for where the conflict lies that kicked .chain out from complemeting the spec. The existing

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
Mark Roberts wrote: Wanting something value-ish, featureless, monadic, is a good goal for a differently named abstraction built on value objects. Promises are not that abstraction. Do the work to show the win, under a new name (Future?). I believe the win has already been

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
mfo...@eldergods.com wrote: The existing promises library users would be faced with a porting problem whose size is hard to estimate Naive go here; Promise.prototype.then= function(fn){ function recurse(val){ if(val.chain) val.chain(recurse)

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Ryan Scheel
I do believe it meant to say 'cheap words and unreality'. Nothing to care about. On Tue, Feb 4, 2014 at 11:04 PM, Brendan Eich bren...@mozilla.com wrote: mfo...@eldergods.com wrote: The existing promises library users would be faced with a porting problem whose size is hard to

Re: Promise.cast and Promise.resolve

2014-02-04 Thread Brendan Eich
Ryan Scheel wrote: I do believe it meant to say 'cheap words and unreality'. Nothing to care about. Thanks -- makes me not care about replying, you are right! /be ___ es-discuss mailing list es-discuss@mozilla.org

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Sébastien Cevey
On 29 Jan 2014 03:42, Brendan Eich bren...@mozilla.com wrote: And so we will go with 'chain'. I assume it has been pointed out before that Underscore/LoDash have popularised their own chain function/concept? http://underscorejs.org/#chaining Hopefully it's distant enough from Promise-world to

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Paolo Amadini
While the getMyPromise question wasn't answered yet and still isn't clear to me, from the other posts I think it can be reworded this way: ```js var p1 = Promise.resolve(Promise.cast(1)); var p2 = Promise.cast(Promise.cast(1)); ``` p1 and p2 will have a different internal state

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Paolo Amadini
On 29/01/2014 5.12, Kris Kowal wrote: In this case, a half pursuit of type purity is a side quest at the expense of users. Having two ways to resolve and two ways to observe a promise is unnecessarily confusing. In my experience, one method like then, that unwraps recursively, and one

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Quildreen Motta
to make as many choices. I would argue that it would make more sense to write `cast` and `then` in terms of `resolve` and `chain`, however. But this seems to have already been decided. Answering your previous question: ```js var p1 = Promise.resolve(Promise.cast(1)); var p2 = Promise.cast

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Kevin Smith
It is, actually, more simplicity. The concept of `Promise.resolve` and `Promise.chain` is simpler than `Promise.cast` and `Promise.then` (i.e.: they represent orthogonal concepts, not complected). `Promise.cast` and `Promise.then` may be, arguably, *easier* to work with, from a user POV,

Promise.cast and Promise.resolve

2014-01-28 Thread Paolo Amadini
I have a suggestion about the current draft of the Promises specification that derives from my experience on the Mozilla code base. I'm not familiar with how the specification process works, discussion in this group seemed like a good start. Those familiar with the subject may find that this

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Kevin Smith
My take is that the difference between cast and resolve is so subtle that I don't think it captures developer intention. In other words, if I see some code calling Promise.cast(otherPromise), I can't be sure that the developer made an intentional choice over Promise.resolve(otherPromise).

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Juan Ignacio Dopazo
On Tuesday, January 28, 2014 10:13 AM, Kevin Smith zenpars...@gmail.com wrote: My take is that the difference between cast and resolve is so subtle that I don't think it captures developer intention. In other words, if I see some code calling Promise.cast(otherPromise), I can't be sure that the

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Kevin Smith
That's not true as per the last consensus. There was `Promise.fulfill(p)` which would've nested promises, but it was left for ES7 to investigate fulfill+flatMap. I don't think that statement is correct. Domenic, Allen, Mark, can we get a ruling? : )

RE: Promise.cast and Promise.resolve

2014-01-28 Thread Domenic Denicola
I am hesitant to retread, but I suppose we should clear up the confusion of the last few messages. Indeed, things evolved slightly since the last consensus, to the point where the solution that made the most sense was to store the promise's resolution value (whatever it may be) then do the

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Mark S. Miller
. For people concerned only about the .then level of abstraction, I see little reason to ever use Promise.resolve rather than Promise.cast, and much reason to prefer Promise.cast. But fwiw we did agree to express the difference now, to be perceived by future and experimental uses of .flatMap in the future

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Paolo Amadini
[Replying here since I'm not sure about how to move the discussion to the issue tracker without losing the context of Mark's observation.] On 28/01/2014 20.28, Mark S. Miller wrote: For people concerned only about the .then level of abstraction, I see little reason to ever use Promise.resolve

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Quildreen Motta
the discussion to the issue tracker without losing the context of Mark's observation.] On 28/01/2014 20.28, Mark S. Miller wrote: For people concerned only about the .then level of abstraction, I see little reason to ever use Promise.resolve rather than Promise.cast, and much reason

FW: Promise.cast and Promise.resolve

2014-01-28 Thread Forbes Lindesay
This accidentally ended up not being forwarded to the list From: Mark S. Miller [mailto:erig...@google.com] Sent: 28 January 2014 19:52 To: Forbes Lindesay Subject: Re: Promise.cast and Promise.resolve That has always been my preference as well. But given the current stage things

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Brendan Eich
Quildreen Motta wrote: If that's correct, I don't see any use cases for Promise.resolve right now, unless a library where to provide a corresponding unspecified `flatMap` implementation. IIRC (and I may not; endless promises threads make me sleepy) this is the reason to have Promise.resolve:

RE: Promise.cast and Promise.resolve

2014-01-28 Thread Domenic Denicola
From: es-discuss es-discuss-boun...@mozilla.org on behalf of Brendan Eich bren...@mozilla.com Quildreen Motta wrote: If that's correct, I don't see any use cases for Promise.resolve right now, unless a library where to provide a corresponding unspecified `flatMap` implementation. IIRC

Re: Promise.cast and Promise.resolve

2014-01-28 Thread Brendan Eich
Domenic Denicola wrote: From: es-discusses-discuss-boun...@mozilla.org on behalf of Brendan Eichbren...@mozilla.com Quildreen Motta wrote: If that's correct, I don't see any use cases for Promise.resolve right now, unless a library where to provide a corresponding unspecified `flatMap`

  1   2   >