Skip to content

keyword arguments for static_hasmethod? #27

@cscherrer

Description

@cscherrer

I think Tricks ought to be able to help us with KeywordCalls, especially cscherrer/KeywordCalls.jl#16.

But static_hasmethod seems to be missing keyword argument support:

julia> methods(static_hasmethod)
# 1 method for generic function "static_hasmethod":
[1] static_hasmethod(f, t::Type{T}) where T<:Tuple in Tricks at /home/chad/.julia/packages/Tricks/TyBuj/src/Tricks.jl:17

julia> methods(hasmethod)
# 2 methods for generic function "hasmethod":
[1] hasmethod(f, t; world) in Base at reflection.jl:1347
[2] hasmethod(f, t, kwnames::Tuple{Vararg{Symbol, N} where N}; world) in Base at reflection.jl:1353

For example, this works:

hasmethod(g, Tuple{}, (:a, :b, :c, :d))

You probably couldn't call it this way to resolve it statically, but maybe this could be done by representing the symbols at the type level, as in named tuple? Or maybe there's a fundamental problem with trying to reason about keyword arguments statically?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions