Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infix vs prefix notation #94

Open
stevekrouse opened this issue Dec 12, 2018 · 2 comments
Open

Infix vs prefix notation #94

stevekrouse opened this issue Dec 12, 2018 · 2 comments

Comments

@stevekrouse
Copy link
Contributor

stevekrouse commented Dec 12, 2018

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.

@stevekrouse
Copy link
Contributor Author

rxjs has this pipe operator which is pretty neat.

But I'd probably prefer being able to do .operator to any stream or behavior.

@paldepind
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants