Promises

Leo Meyerovich lmeyerov at gmail.com
Sun Nov 11 13:02:37 PST 2012


I've been lurking on this thread and am somewhat confused. Is the motivation for promises  a needed expressive primitive, updating the standard library to have asynchronous calls and structure them via promises,  sugar, or something else? I assume it's not to proscribe one particular style of coordination over another, which would have little empirical validation.

-- If it's for asynchronous standard API, why shouldn't coordination be a user-level framework decision? E.g., have one callback for each async API (or two, succeed and fail), and leave the rest up to the coordination framework of the day? Simple API structure, like one of these patterns, will help framework writers make generic wrappers, but introducing more seems excessive. The main use case for APIs would be (AFAICT) to allow frameworks to introspect on whether an API call is async. Promises would enable inspecting the return value, but this seems awkward and maybe even late.

-- If the motivation is for language-level issues, I'm curious as to how this relates to topics like compiler optimization, multiprocessing, cross-frame communication, etc. Furthermore, are there any semantic concerns coming up (e.g., E style vats), or is the intent here purely sugar? (I assume blocking on a Liskov-style future will not be allowed).

-- For sugar, a lightweight lambda and, if still desired, macros, seem to eliminate much of the need of a primitive. 

Hopefully my confusion as to the motivation and design space here is clear :)

Regards,

- Leo



More information about the es-discuss mailing list