-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 call syntax for binary functions #8824
Comments
For future reference we had some discussion about this on reddit: [link] The most important point was that backticks are probably not desirable, and a better syntax might be:
|
would this have a way of setting fixity / associativity? |
Well this whole thing is speculative, so all we have is our ideas and opinions. I think that would introduce usability issues again -- if you're looking at some code using |
numerical linear algebra code. Probably where I'd be building up an AST model of the "math" then running a version that internally does an inplace update execution using a fixed number of pre allocated array buffers. |
Would having to explicitly parenthesize be horrible? |
nope, was just asking. I understand that being conservative for near term features is important. |
@brson Any thoughts on this? I'm guessing this would require a proper RFC with the new process, but is this something Rust would be interested in supporting? |
Closing, a change such as this should go through the RFC process, both to flesh out and get community feedback. |
Allow calling binary functions infix. Functions and method calls are enclosed by mandatory parantheses, and these obscure the logic of the code when nested.
Methods are already placed neatly (like operators) bewteen two objects (
a .eq (b)
) but with an infix call we can make this easier to read.can be
and instead of overloading
+
for lists we can haveor a parser can use
Infix binary functions are simpler and have less drawbacks compared to arbitrary user operators. They are also more flexible than the builtin set of operators (that are limited in number and force call by
&T
).The text was updated successfully, but these errors were encountered: