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
Other than editing Julia Base, one way which seems that may work is to exclude args to not be a type.
Do we have something like !:T?
This is my crazy prototype (doesn't work obviously):
zerosM(args::T...; like::AbstractArray) where {T!::Type{T1}} where {T1} =zeros(eltype(like), args...)
julia> fun(x::Integer) = 1
fun (generic function with 1 method)
julia> fun(x::Integer; y::Array) = 1
fun (generic function with 1 method)
julia> fun(x::Integer, y::Array) = 1
fun (generic function with 2 methods)
The 2nd definition doesn't create another method
I know that I can make keyword optional by
julia> fun(x::Integer; y::Array= nothing) = 1
fun (generic function with 1 method)
But in my situation, I am expanding another function's methods, and the function has fun(x::Integer) = 1 originally, and I don't want to overwrite that method.
However, the keyword arguments never participate in dispatch, and so there is no way other than redefining the original methods.
Like method is added for manually defined methods, but still needs to be added for default zeros, ones, rand methods
Different tasks of this to do plan:
Achievement check:
having both:
The text was updated successfully, but these errors were encountered: