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
Not sure whether this is by design or something can be improved upon.
myfunc(; x::Int64=1) = x + 1
myfunc(; y::Int64=1) = y + 1
Below are the results of calling these functions.
julia> myfunc(x=1);
ERROR: unrecognized keyword argument "x"
julia> myfunc(y=2);
The second definition of myfunc overrides the first one given that keyword arguments are not part of the function signature. It implies we can define generic functions with different keyword arguments.
The question is whether it is by design, or is there any way to achieve the similar effect?
The text was updated successfully, but these errors were encountered:
Not sure whether this is by design or something can be improved upon.
Below are the results of calling these functions.
The second definition of
myfunc
overrides the first one given that keyword arguments are not part of the function signature. It implies we can define generic functions with different keyword arguments.The question is whether it is by design, or is there any way to achieve the similar effect?
The text was updated successfully, but these errors were encountered: