You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following snippet, when f()=1 is defined, it should overwrite the previous f(;a)=2 (because dispatch should only be performed on the positional arguments and both of these have no positional arguments). The methods function incorrectly indicates the wrong method survived, and both methods appear to be reachable. Per the discourse discussion, there is some debate on these points!
C:\Users\klaff>julia -q
julia> f(;a)=2
f (generic function with 1 method)
julia> f()=1
f (generic function with 1 method)
julia> methods(f)
# 1 method for generic function "f":
[1] f(; a) in Main at REPL[2]:1
julia> f()
1
julia> f(a=1)
2
julia>
The text was updated successfully, but these errors were encountered:
See https://discourse.julialang.org/t/im-confused-about-methods/48508/4
In the following snippet, when
f()=1
is defined, it should overwrite the previousf(;a)=2
(because dispatch should only be performed on the positional arguments and both of these have no positional arguments). Themethods
function incorrectly indicates the wrong method survived, and both methods appear to be reachable. Per the discourse discussion, there is some debate on these points!The text was updated successfully, but these errors were encountered: