turbine
turbine copied to clipboard
Infix vs prefix notation
We have Behavior#map but also filterApply, when, etc that are prefix. Uniformity is the biggest issue, but I prefer the infix notation, and would prefer it everywhere where possible.
rxjs has this pipe operator which is pretty neat.
But I'd probably prefer being able to do .operator to any stream or behavior.
My thinking was
- "Core" operators are available as methods.
- Non-"core" operators are only available as function.
But I agree that it can be confusing. To make it less confusing the (future) documentation could make it very clear which operations are core and which are not. But still, it is not idea.
The reason for not making everything methods is that functions can be tree-shaken whereas methods can't be tree-shaken which will lead to bigger bundles.
In the List library I took an approach where methods can optionally be imported with `import "list/methods". This makes methods (and the increase in bundle size) opt-in. That is also an option.