One way to keep type stability is to mark the function with Base.@pure or Base.@assume_effects :total. However, this approach does not work with precompile.jl. Based on the Discourse discussion, methods() has world age problems with either Base.@pure or Base.@assume_effects. I don't know the details about this issue, but I don't like this solution.
There is an alternative way of checking number of args:
function is_time_dependent(f::Function)
applicable(f, zeros(6), 0.0) ? true : false
end
Maybe let's switch to this method first and see how it works.
The current implementation of
is_time_dependent
is type unstable, most likely due to the usage ofmethods
: https://github.com/henry2004y/TestParticle.jl/blob/fd5d83ee3e2e6cd77c589dde1e44660517c90a9c/src/TestParticle.jl#L171-L186One way to keep type stability is to mark the function with
Base.@pure
orBase.@assume_effects :total
. However, this approach does not work with precompile.jl. Based on the Discourse discussion,methods()
has world age problems with eitherBase.@pure
orBase.@assume_effects
. I don't know the details about this issue, but I don't like this solution.There is an alternative way of checking number of args:
Maybe let's switch to this method first and see how it works.