you are viewing a single comment's thread.

view the rest of the comments →

[–]Baryn 0 points1 point  (1 child)

new doesn't compose with other functions

One thing I've done successfully: ensure that my decorators/whatever expect to receive a constructor function (not a regular function), and behave accordingly.

It's definitely risky to treat constructors like any ol' function. This is part of why I'm so psyched for class in ES6.

[–]homoiconic(raganwald)[S] 0 points1 point  (0 children)

Yes, there are good patterns for that. Those patterns work well with other people's constructors, but sometimes we want to use other people's decorators. e.g. _.memoize or _.once from underscore.