Named factory functions

Jordan Harband ljharb at gmail.com
Sun Feb 3 19:43:42 UTC 2019


I suspect that would break a ton of code - ES6 name inference already broke
some of mine, but I was able to work around it by using this kind of
indirection.

On Sun, Feb 3, 2019 at 11:02 AM Sultan <thysultan at gmail.com> wrote:

> Where there any attempts to allow factory functions the ability to assume
> the name of the binding they are assigned to?
>
> Consider the following:
>
> function factory () { return function () {} }
> var foo = factory()
> console.assert(foo.name === 'foo')
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190203/8c76758a/attachment.html>


More information about the es-discuss mailing list