Reflection to know if executed within a generator/async ?

miguel de Sousa miguel.tronix at
Mon Dec 7 08:02:16 UTC 2015

I have an objection to that, async is just a special case of sync, like
square to rectangle. Why shouldn't the promise be inviolable?

On Mon, 7 Dec 2015 7:00 pm Claude Pache <claude.pache at> wrote:

> Le 7 déc. 2015 à 07:48, Andrea Giammarchi <andrea.giammarchi at> a
> écrit :
> I've asked for opinions and if in 2 days I haven't replied means I got it
> my idea is not welcome which is OK and fair enough.
> However, I'm curious to know about this "Functions that sometimes return
> promises and sometimes not are already known to be an antipattern"
> because I have a library that does that in somehow explicit way (if you
> pass a callback it doesn't return  a promise, it invokes such callback once
> resolved) and it works without any real-world problem.
> Mind pointing me at the library that failed returning Promises arbitrarily?
> The blog post pointed by Ron earlier in this thread contains a discussion
> about how sync and async code differ, and thus why it is generally not a
> good idea to execute random code sometimes asynchronously and sometimes not
> (with a pointer to a concrete example). It is worth reading.
> —Claude
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list