-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
Decorators for classes, methods, and object properties are a really nice extension to the language. The only extra one I would like to see is the ability to add decorators to function declarations:
@RunOnce
function expensiveOperation() {
return 1 + 1;
}
de-sugars to:
var expensiveOperation = RunOnce(function expensiveOperation() {
return 1 + 1;
});
This suggests allowing decorators for any assignment, but I think that might be a bit much so I'm leaving it out of this PR:
// For the curious, that would allow constructs like this
@RunOnce
let expensiveOp = () => 1 + 1
// De-sugars to
let expensiveOp = RunOnce(() => 1 + 1);
nickell, rickmed, timhwang21, darsain, btipling and 125 moreiamthesiz, davidqqq, stylemistake, matthewhuang-camelot, laurentpayot and 26 morelaurentpayot, liron-navon, mprinc, rogerpadilla, Heartnett and 7 morelaurentpayot, mprinc, acro5piano, rogerpadilla, Heartnett and 5 more
Metadata
Metadata
Assignees
Labels
No labels