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
[RFC] Support Uniform Function Call Syntax #31779
Comments
This goes against Julia's functional philosophy and threatens to make Julia into an OO language, so I don't think you're going to get much agreement from experienced Julia developers. |
Also, note that it'd be more idiomatic to just define:
No need to name it To your point, I consider this to be quite ergonomic. |
I don't see how a new way to call a function threatens a whole language to become OOP. That's a slippery slope fallacy. People are writing functions associated with structs right now and that's not a threat to the language. |
Nim is a procedural language that takes this idea pretty far and it is very imperative oriented: https://narimiran.github.io/nim-basics/#_calling_the_procedures |
Another benefit I see to uniform function call syntax is the support of autocomplete in IDEs/REPL for Julia. One would simply suggest a list of functions with the variable's type as a first parameter. |
Let's put autocomplete aside for a moment, since it's mostly orthogonal to your RFC. Let's also not discuss just ergonomics since that is mostly a matter of personal choice, and UFCS doesn't actually shorten the number of keys you have to press to achieve effectively the same behavior with idiomatic Julia code (as I demonstrated above). What concrete benefits do you see from adding UFCS to Julia? What things are currently difficult/infeasible to do with idiomatic Julia syntax that UFCS would improve on? If you can, try to refrain from pointing to other languages as the core of your example, and instead focus on what people use Julia for today, and how UFCS can help them. Specific examples would be very helpful as well! If you can illustrate how UFCS really is a game-changer or significant improvement over what's currently possible, without any significant downsides to implementing it, maintaining it, and seeing its usage become commonplace in the package ecosystem, then I think you'll be able to garner support and valuable discussion for your RFC. |
The basic problem with allowing |
isn't this a duplicate issue of #25052? |
It solves problem of function chains natively
instead of
And it has absolutely nothing with object oriented stuff. And yes - it's much better to use in IDE with autocompletion. |
Why is this issue closed? |
Because aside from tab completion there are nothing but negatives to it? In general we don't make changes that would make stuff worse. |
@timholy so you consider this
as being superior to
Right? With multi-line it will be even more interesting. |
@alexeyPetrushin, you can already use [-1,2,3] .|> x->x^2 .|> x->x^2 .|> x->x^2 (and maybe We also have ((([-1,2,3].^2).^2).^2) These have the additional advantage over chaining And you can also chain [-1,2,3] |> y->map(x -> x^2,y) |> y->map(x -> x^2,y) |> y->map(x -> x^2,y) |
@stevengj try use pipes for functions with many arguments, don't know how things are now, but previously julia pipe had limitations. This last line |
Being able to write data processing pipelines from left to right is a happy accident that |
Yes, you can write I think the proposal with the most support (#24990) has been to implement nicer multi-argument function chaining in the future with something more flexible like the Scala-like syntax Furthermore, the proposed "uniform function call syntax" wouldn't even solve this, because it would transform Julia isn't an OO language. The first argument isn't special for dispatch, so OO-like syntax here is a non-starter. |
is answered by
And it is a valid answer.
the first elements in a list is neither special so Asides from this, I am start recognizing the community being toxic and fundamentalism. |
Cool reaction, dude. Devs take the time to explain why something isn't a good fit for this language. You call them toxic for explaining it to you. There's nothing "fundamentalist" about this. If you're going to engage here, at least engage with what someone has actually written. The |
Since Julia is struct oriented, this could be a nice way make the language more ergonomic for methods
https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax
Assume
In addition to this syntax
this would also be acceptable if a function signature existed with Blah as first parameter type
Edited: fixed function name to be idiomatic
The text was updated successfully, but these errors were encountered: