-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
don't warn if _
is used twice
#18251
Comments
It's not currently a warning, though, it's an error, no? |
I don't think we should make this a special case unless we go all the way to making |
That would be fine with me as well. |
The real confusion for me was that |
One of the idiomatic Julia things is to leave out the variable name and only keep the type hint, as in: foo(::SomeType) = 42 so this works: foo(::SomeType, ::SomeType) = 84 "Yes, but what if one does not want to explicitly use types?", I hear you say. This works too, julia> f(::) = println("ah!")
f (generic function with 1 method) although not as (I) expected, because: julia> h(::, ::) = println("dude!")
ERROR: syntax: function argument names not unique So Julia takes "::" to be the actual variable name, rather than an unnamed variable of type But this works entirely fine: julia> h(::Any, ::Any) = println("dude!")
h (generic function with 1 method) I realize that many functional programming languages use |
Closing as duplicate of #9343 |
https://groups.google.com/forum/#!topic/julia-users/8S41r1KjdC4
How about not emitting this warning in the case where the variable name used twice is
_
? I'm not proposing making_
special in any other way – just skipping this warning for it.The text was updated successfully, but these errors were encountered: