-
Notifications
You must be signed in to change notification settings - Fork 564
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
Functional operators #1154
base: main
Are you sure you want to change the base?
Functional operators #1154
Conversation
A small note: while working, precedence of operators has only been tested between themselves and will probably need tuning based on feedback and usage. |
I see that you have also reserved Any plans on what to use that for? |
To put it simply, I thought it was the way to to make an error here, but it's a mistake. That said, I think it would be a nice user defined operator. If my memory is correct, squeak/pharo use it to define coordinates/points. It can be a nice addition, but for now I don't really plan to implement it unless there is more user interest. |
Thanks for sharing. I think that maybe reusing |
That operator is required to prepare and pass pipeline parts using variables. That mean, they can be passed as arguments and returned from functions/methods. This allow pipelines calls to be programmatically tuned while using a fixed chain of calls. No, we can't reuse any of the already defined ones basically because of functor objects (that you encounter usually when trying to functions of different arity, eg when emulating function with default values). It has the consequence that theses operator must be built-ins. |
Now that I've had more time to think about this, I'd just like to add my two cents to what I think is basically a good proposal.
|
@PureFox48 Can you describe operator precedence in terms of between operators? Expressing in terms of numbers is not really clear, and might change with possible additions. |
Sorry, I was referring to the table here in the docs. I can't make up my mind whether they should be inserted in the table at 13 and 14 between |
On reflection, I don't think it would be a good idea to place them after You could put them just before |
0d79e6f
to
985dc43
Compare
I also always struggle with these questions. I updated the priority to be in par with the JS pipeline. My main question was about the |
In practice, I suspect that many people (myself included) put parentheses around stuff either just for clarity or because they can't remember what the operator precedence rules actually are. No doubt this will also apply to these operators if they're adopted but we do, of course, still have to come up with a definite priority for them. I see that you've updated the proposal to put them just ahead of |
An attempt at #1144 and more:
|<
and|>
@<
and@>
This is a lot of syntaxic sugar, but it should help readability of cascaded function calls.