3 ms·
Decorator's shouldn't be a part of javascript when function composition serves the same purpose without adding additional syntax.
by maxthegeek1 10y ago
Decorator's shouldn't be a part of javascript when function composition serves the same purpose without adding additional syntax.
- acjohnson55 10y agoTo play Devil's advocate, function composition can accomplish literally anything that's conputable, and principle of least power would suggest that having specific and limited syntax for common patterns is productive. If Javascript continues to admit statement-based syntax, I think decorators are appropriate, because they allow the functional decorator pattern to be applied to function (and method, and class) declarations.
- olalonde 10y agoMost of the things that were introduced in ES6 were already possible without adding additional syntax (classes, arrow functions, etc.).
- dismantlethesun 10y agoFunction composition is so common it deserves its own syntax.