proposal-function-memo
proposal-function-memo copied to clipboard
Prototype method, static method, decorator
Should memo be a prototype method, a static function, a function decorator, or multiple?
This depends most on whether memo will be mostly used on anonymous functions, named function declarations, and/or class methods.
.bind is a prototype method.
Underscore and Lodash (necessarily) use static functions.
Python’s lru_cache is a decorator, although we don’t have function decorators yet.
I'm strictly for a prototype method for .bind consistency and simplicity of usage.
I would also prefer a prototype method