I've already read through the significant prior discussion on the
difficulties of supporting decorators for function declarations. I'm not
trying to rehash that here!
From a real world readability perspective, I think it's a big mistake to
disallow decorating hoisted functions. For example, when returning an
object with attached functions, it's much easier to read if the export
object is at the top, with the implementation details below (think object
creation functions, angular 1 services). In fact with well named functions
putting the implementation front and center impedes readability, since
people tend to understand functions better when they read them breadth
first with implementation details abstracted (function declared below
return, only have to be aware of one context, one scope).
Anyway, I don't want to rant about it. I did stumble across this Stage 0
proposal (goo.gl/8MmCMG) by Igor Minar, and supposedly working with
Yehuda Katz, on allowing decorators for function expressions and
declarations through Mirrors (a separate proposal).
Does anyone know the status of this and the corresponding Mirrors proposal?
Having issues digging up information. Planning to work on a new proposal if
nothing's in motion.
Hey All!
I've already read through the significant prior discussion on the
difficulties of supporting decorators for function declarations. I'm not
trying to rehash that here!
>From a real world readability perspective, I think it's a big mistake to
disallow decorating hoisted functions. For example, when returning an
object with attached functions, it's much easier to read if the export
object is at the top, with the implementation details below (think object
creation functions, angular 1 services). In fact with well named functions
putting the implementation front and center impedes readability, since
people tend to understand functions better when they read them breadth
first with implementation details abstracted (function declared below
return, only have to be aware of one context, one scope).
Anyway, I don't want to rant about it. I did stumble across this Stage 0
proposal (https://goo.gl/8MmCMG) by Igor Minar, and supposedly working with
Yehuda Katz, on allowing decorators for function expressions and
declarations through Mirrors (a separate proposal).
Does anyone know the status of this and the corresponding Mirrors proposal?
Having issues digging up information. Planning to work on a new proposal if
nothing's in motion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161118/3c3652ce/attachment.html>
Hey All!
I've already read through the significant prior discussion on the difficulties of supporting decorators for function declarations. I'm not trying to rehash that here!
disallow decorating hoisted functions. For example, when returning an object with attached functions, it's much easier to read if the export object is at the top, with the implementation details below (think object creation functions, angular 1 services). In fact with well named functions putting the implementation front and center impedes readability, since people tend to understand functions better when they read them breadth first with implementation details abstracted (function declared below return, only have to be aware of one context, one scope).
Anyway, I don't want to rant about it. I did stumble across this Stage 0 proposal (goo.gl/8MmCMG) by Igor Minar, and supposedly working with Yehuda Katz, on allowing decorators for function expressions and declarations through Mirrors (a separate proposal).
Does anyone know the status of this and the corresponding Mirrors proposal? Having issues digging up information. Planning to work on a new proposal if nothing's in motion.