Reflection to know if executed within a generator/async ?

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Dec 8 17:44:11 UTC 2015


yup, that's what my library does as well. I thought Bergi meant in absolute.

On Tue, Dec 8, 2015 at 5:38 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:

> On Sun, Dec 6, 2015 at 10:48 PM, Andrea Giammarchi
> <andrea.giammarchi at gmail.com> wrote:
> > 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.
>
> This pattern is fine; different overloads of a function are basically
> different functions, and we're using this pattern in the web platform
> in a few places to "update" some CB-using APIs to Promises.  As long
> as the function previously returned void and took the CB last, we can
> do it.
>
> ~TJ
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151208/b2f2268d/attachment.html>


More information about the es-discuss mailing list