On Friday, April 18, 2014 2:46:29 PM UTC+2, willem dhaeseleer wrote:
>
> // async
>
>
> I think that is very verbose, It will not be very helpful to someone who
> doesn't know galaxy well or even does know coroutines. ( is it a coroutine,
> is it a generator ? its both ! )
>
> If your APIs return promises, you'll need to provide wrappers to
>> transform both ways between promises and callback-based APIs.
>
>
> Bruno, that is simply not true. If a library returns promises u can just
> use the promise. You will always need to write more code to convert a
> promise to a callback style function then to just *use* the promise.
>
To clarify, I meant that nodejs developers will want these wrappers.
>
> I'm using streamline which works directly with node.js callbacks.
>
>
> Streamline.js also provides "futures", also by using a special syntax.
> *!_*
> ( which is also noise imo )
>
Yes but a streamline future is a standard nodejs callback-based function.
You can use it as future(function(err, result) { ... }).
You don't need all the sophistication of promises to provide promise-like
functionality (the essence of it, i.e. the ability to encapsulate a
computation which will yield a result later). You can do it with a simple
callback-based design, by currying the callback.
>
> So if you use both libs, you are using two different type of control flow
> libraries ( of which one is a pre-processor ) , that both allow you to
> create async encapsulations with special syntaxes, to workaround callbacks.
>
> I think I will just stick to promises.
> I can't help but feel that they are more uniform, cleaner and how
> ECMAScript is intending async control flow in the future.
>
I did not jump in to convince you to use galaxy or streamline (I got bored
with this kind of exercise), rather to develop Alex' point that "you *can*
have coroutines without promises". Promises don't really cut it when it
comes to solving the "sync-style coding" challenge. What cuts it is
generators (fibers and preprocessors too).
Bruno
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.