Андрей Губанов (2019-09-04T10:48:44.000Z)
andrey.a.gubanov at gmail.com (2019-09-04T10:53:43.141Z)
Here I described my thoughts about this topic https://github.com/finom/function-decorators-proposal. The main idea of moving forward with function decorators is to make them behave like there were defined and wrapped by another function, not more, and get rid of any hoisting when they're used. # Function expressions and arrow functions ```js const foo = @decorator1 @decorator2 function bar() { return "Hello" } // Will become: const foo = decorate([decorator1, decorator2], function bar() { return "Hello" }); ``` And ```js const foo = @decorator1 @decorator2 () => "Hello" // Will become: const foo = decorate([decorator1, decorator2], () => "Hello"); ``` # Function declarations And this is the most important. I propose to make a decorated function declaration behave as let definition. ```js @decorator1 @decorator2 function foo() { return "Hello" } // Will become: let foo = decorate([decorator1, decorator2], function foo() { return "Hello" }); // no hoisting! ```
andrey.a.gubanov at gmail.com (2019-09-04T10:53:05.335Z)
Here I described my thoughts about this topic https://github.com/finom/function-decorators-proposal. The main idea of moving forward with function decorators is to make them behave like there were defined and wrapped by another function, not more, and get rid of any hoisting when they're used. # Function expressions and arrow functions ```js const foo = @decorator1 @decorator2 function bar() { return "Hello" } // Will become: const foo = decorate([decorator1, decorator2], function bar() { return "Hello" }); ``` And ```js const foo = @decorator1 @decorator2 () => "Hello" // Will become: const foo = decorate([decorator1, decorator2], () => "Hello"); ``` # Function declarations And this is the most important. I propose to make a decorated function declaration behave as let definition. ```js @decorator1 @decorator2 function foo() { return "Hello" } // Will become: let foo = decorate([decorator1, decorator2], function foo() { return "Hello" }); // no hoisting! ```
andrey.a.gubanov at gmail.com (2019-09-04T10:52:41.831Z)
Here I described my thoughts about this topic https://github.com/finom/function-decorators-proposal. The main idea of moving forward with function decorators is to make them behave like there were defined and wrapped by another function, not more, and get rid of any hoisting when they're used. # Function expressions and arrow functions ```js const foo = @decorator1 @decorator2 function bar() { return "Hello" } // Will become: const foo = decorate([decorator1, decorator2], function bar() { return "Hello" }); ``` And ```js const foo = @decorator1 @decorator2 () => "Hello" // Will become: const foo = decorate([decorator1, decorator2], () => "Hello"); ``` # Function declarations And this is the most important. I propose to make a decorated function declaration behave as let definition. ```js @decorator1 @decorator2 function foo() { return "Hello" } // Will become: let foo = decorate([decorator1, decorator2], function foo() { return "Hello" }); // no hoisting! ```
andrey.a.gubanov at gmail.com (2019-09-04T10:52:28.126Z)
Here I described my thoughts about this topic https://github.com/finom/function-decorators-proposal. The main idea of moving forward with function decorators is to make them behave like there were defined and wrapped by another function, not more, and get rid of any hoisting when they're used. # Function expression and arrow functions ```js const foo = @decorator1 @decorator2 function bar() { return "Hello" } // Will become: const foo = decorate([decorator1, decorator2], function bar() { return "Hello" }); ``` And ```js const foo = @decorator1 @decorator2 () => "Hello" // Will become: const foo = decorate([decorator1, decorator2], () => "Hello"); ``` # Function declarations And this is the most important. I propose to make a decorated function declaration behave as let definition. ```js @decorator1 @decorator2 function foo() { return "Hello" } // Will become: let foo = decorate([decorator1, decorator2], function foo() { return "Hello" }); // no hoisting! ```
andrey.a.gubanov at gmail.com (2019-09-04T10:51:26.488Z)
Here I described my thoughts about this topic https://github.com/finom/function-decorators-proposal. The main idea of moving forward with function decorators is to make them behave like there were defined and wrapped by another function, not more, and get rid of any hoisting when they're used. Function expression and arrow functions ```js const foo = @decorator1 @decorator2 function bar() { return "Hello" } // Will become: const foo = decorate([decorator1, decorator2], function bar() { return "Hello" }); ``` And const foo = @decorator1 @decorator2 () => "Hello" // Will become: const foo = decorate([decorator1, decorator2], () => "Hello"); <https://github.com/finom/function-decorators-proposal#function-declarations>Function declarations And this is the most important. I propose to make a decorated function declaration behave as let definition. @decorator1 @decorator2 function foo() { return "Hello" } // Will become: let foo = decorate([decorator1, decorator2], function foo() { return "Hello" }); // no hoisting!