Promises/A+ spec implementations?

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 19 18:10:37 PDT 2015


On Wednesday, 19 August 2015 at 04:18:03 UTC, Alexander J. 
Vincent wrote:
> Hi, folks.  Over ten years ago I had some interest in the D 
> language.  I'm starting to think about it again...
>
> I've been using Mozilla's Promises implementations for quite a 
> while, now, and they're surprisingly nice to work with.  They 
> are the next generation beyond the callback function patterns I 
> learned in JavaScript.  I've been thinking that writing a 
> Promises/A+ library for D would be a good task for a relatively 
> inexperienced D programmer.  I didn't see any Promises/A+ 
> implementations in the standard library or on code.dlang.org.
>
> Now, whether I write that library or someone else beats me to 
> it, I don't really care right now.  I'm interested in doing it, 
> but my time is extremely limited.  I'm mainly posting this as a 
> request to get a Promises/A+ library started, and for me to 
> observe the process of crafting a library.  If someone wants to 
> be a mentor for me on this, answering direct questions, that'd 
> be great.
>
> The spec for Promises/A+ is at https://promisesaplus.com/ . 
> Mozilla's Bobby Holley recently wrote a good blog post about a 
> "MozPromise" implementation which includes supporting 
> multithreading (a concept I don't fully understand how to write 
> for, yet) and cancelling a Promise (which isn't in the spec, 
> but makes sense for Mozilla's purposes).  That blog post is at 
> http://bholley.net/blog/2015/mozpromise.html .
>
> Finally, I had an old login to this forum (kb7iuj), which I've 
> long forgotten the password for.  I did see that there's no 
> password recovery support, so could someone just terminate that 
> login for good?

IMO the 'next' generation of async is fibers/coroutines, not 
promises. Vibe.d is a great example; the code looks exactly like 
a normal synchronous function (including try/catch!), but is 
asynchronous behind the scenes.

See also vibe.d's feature page [1] and examples [2]

There's also C#'s async/await, but that's a syntax feature and I 
don't know how they work.

[1]: http://vibed.org/features#fibers
[2]: http://vibed.org/docs



More information about the Digitalmars-d-learn mailing list