J. S. Choi
J. S. Choi
At the plenary meeting today, several representatives (@waldemarhorwat, @ljharb) seemed to support returning `undefined` every time, due to #5. (Errors from first call would throw only on the first call...
(For what it’s worth, I am willing to champion a separate, configurable `memoize` helper function.)
For what it’s worth, I have also created a [proposal-function-memo](https://github.com/js-choi/proposal-function-memo), which might cover singleton use cases, and which I plan to present to a future plenary. It’s very unspecified right...
@ckknight: Indeed, there is an issue devoted to this question, #5. We need to do research to see if there are any use cases for non-nullary “once” functions that are...
Thanks for raising this issue. From what I recall, [SugarJS stopped conditionally monkey-patching Function.prototype around 2016](https://github.com/andrewplummer/Sugar/blob/0c6f63cc5e13f145a61a2211efef6e21f509578b/lib/core.js#L52-L60) (see also [Bugzilla 1750812](https://bugzilla.mozilla.org/show_bug.cgi?id=1750812#c5)). So this partially depends on whether there are any codebases...
What matters is if the monkey patching of Function (or Function.prototype) is _conditional_. Unconditional monkey patching won’t be affected by extending the built-in. At least [V4Core’s monkey patching does not...
> But if we are considering some syntax proposal, for example, extensions or call-this proposal, we could consider something like `value->do.pipe(f)` (or `value->let(f)` if use Kotlin-style name). Although I applaud...
Yes, adding both is also an option, though it makes me ask if then it would not be appropriate to do the same for `bind`: adding a `Function.bind` in addition...
> Adding static `Function.bind` will be a breaking change. I saw (and used) `Function.bind` as a shortcut for `Function.prototype.bind` too many times… Ah, yeah, silly me. I had forgotten that...
Function.prototype.once would keep open the possibility of a @Function.once decorator, for whenever function decorators hopefully get standardized in the future. In contrast, a Function.once static method would probably permanently exclude...