goodeggs / fibrous

Easily mix asynchronous and synchronous programming styles in node.js.
MIT License
181 stars 25 forks source link

Promises/A+ Compliance #30

Open hurrymaplelad opened 10 years ago

hurrymaplelad commented 10 years ago

Imagine, webdriver checks run in parallel:

fibrous.wait [
  browser
    .elementByCss '.entry-title'
    .text().should.become "Fibrous & Promises"

  browser
    .elementByCss '.entry-author-name'
    .text().should.eventually.contain "Could be you!"
]

It's possible today with:

fibrous.wait [
  browser
    .elementByCss '.entry-title'
    .text().should.become "Fibrous & Promises"
    .future.nodeify()

  browser
    .elementByCss '.entry-author-name'
    .text().should.eventually.contain "Could be you!"
    .future.nodeify()
]

but it could be cleaner. Any reason not to have fibrous futures comply with Promises/A+, and have fibrous.wait accept any A+ promise?

hurrymaplelad commented 10 years ago

Realized changes would be pretty much entirely in core node-fibers. Opened an issue there to discuss. Might make sense to layer on A+ support as a separate module, and consume that module in fibrous if folks are into it.

hurrymaplelad commented 9 years ago

Confirmed from the fibers author, doesn't belong in core fibers, but would makes sense as a separate modules.

How's a new fibers-aplus module sound? It'd extend fibers/future with a Promises/A+ interface, and extend Future.wait to accept any A+ promise.