Decorators for functions

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Oct 20 10:33:55 UTC 2015


You haven't provided a single use-case example, like how are you going to
decorate a function or why.

IMO if implemented it will be incompatible with non ES6 code unable to
distinguish between classes and functions unless fully transpiled, making
decorators less portable.

One thing I like about current state is that you can use decorators even in
ES5 browsers [1]

Just my 2 cents, Regards


[1] as shown in the second example of the universal mixin module
https://github.com/WebReflection/universal-mixin#universal-mixin-

On Tue, Oct 20, 2015 at 10:30 AM, Axel Rauschmayer <rauschma at icloud.com>
wrote:

> https://github.com/wycats/javascript-decorators/blob/master/README.md
>
> The decorator proposal does not include decorators for functions, because
> it isn’t clear how to make them work in the face of hoisting.
>
> However, it would be great to have them. I see two possible solutions:
>
> – A decorator on a function declaration prevents hoisting.
>
> – Enable decorators for function expressions, arrow functions and
> generator function expressions.
>
> Does either one of those make sense?
>
> Axel
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
>
>
>
> _______________________________________________
> 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/20151020/556d6479/attachment.html>


More information about the es-discuss mailing list