Familiarity Bias is Holding You Back
Sounds like you have a familiarity bias against currying or higher-order functions. That’s a big mistake.
The example is a simple higher-order function wrapper around function composition. All it does is supply a default object if one does not get passed, and allow you to customize how the composition gets done.
AFAIK, Python, Rust, and Self are the only major languages that use `self` instead of `this`. C++, Java, C#, and at least a dozen other major programming languages use `this`. The only major difference between those and JS is that in JS, `this` is dynamic, which allows us to delegate method calls… a fundamental feature of the prototypal paradigm in…
In category theory, there are categories, and arrows between categories. An arrow is called a “morphism”, and is roughly analogous to a “function”. A “function” is roughly analogous to a “pipeline stage”.
Lots of people are familiar with that usage of the word “function”. “Pipeline stage” is a name you just made up.
Looks like we disagree on all counts.
pipe()is not very useful, unless you know what
pipe()is already, in which case you’ll recognize it without the name. In the case where you want to override the behavior,
mixis already a much better general name that won’t conflict with…
I assert that if your function already has a good name, this behavior is an anti-pattern. Cluttering things with extra names is just as bad as cluttering things with extra syntax. The user is forced to read the definition and store the connection in their working memory. Why waste slots in working memory when you don’t need to?