domenic at domenicdenicola.com
Tue Nov 6 15:05:20 PST 2012
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 then returns ."
This trick is borrowed from Kris Kowal's UncommonJS promises specification.
> -----Original Message-----
> From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
> bounces at mozilla.org] On Behalf Of David Bruant
> Sent: Tuesday, November 6, 2012 14:43
> To: Rick Waldron
> Cc: EcmaScript
> Subject: Re: Promises
> 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 "promise" is really just a plain object or
> > function with an expando property, I would think that a language level
> > addition would require its own standard built-in object: Promise,
> > which when invoked as a constructor initializes a new promise object
> > which has a "then" method... Domenic has it covered from there.
> I fully agree.
> > 2. The notes describe some excellent practical implementation points,
> > but none of them are actually part of the ECMAScript standard, eg.
> > setTimeout, process.nextTick. Should these be specified or left
> > unspecified? Object.observe describes delivery as "Schedule change
> > events to be delivered asynchronously 'at the end of the turn'", which
> > is not very specific.
> As I suggested, Object.observe opens the breach and I think it means the
> event loop (including the notion of "turn") will have to be fully specified within
> > 3. Does this belong in the language or would it make more sense to
> > exist as a "standard module"?
> Are you referring to the event loop or promises?
> event loop : the language
> promises : arguably standard module
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss