New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing import of PseudoSteppingSchemes.adaptive_step_parameters
?
#300
Comments
It looks like PseudoSteppingSchemes is importing it from EnsembleKalmanInversions |
But how is EnsembleKalmanInversions using the method PseudoSteppingSchemes defines without importing it? |
It's defined by |
But not that method. Or I missed it…. |
ParameterEstimocean.jl/src/ParameterEstimocean.jl Lines 46 to 47 in f939c72
So, it defines the function
Next,
and extends it here:
|
But in line I'm referring at the first comment on this issue, |
The method to be used is resolved at the time the function is called (it doesn't have to do with the order in which the methods are defined). So by the time the user calls The title of this issue says that |
This is an example: julia> import ParameterEstimocean.Utils: tupleit
julia> tupleit(1)
(1,)
julia> tupleit(a::Number) = println("This isn't a tuple at all")
tupleit (generic function with 2 methods)
julia> tupleit(1)
This isn't a tuple at all |
Or maybe this is a clearer example, where one function is used by another: julia> g(x, y) = x + y
g (generic function with 1 method)
julia> f(x, y) = 2 * g(x, y)
f (generic function with 1 method)
julia> f(1, 2)
6
julia> g(x::Float64, y::Float64) = x - y
g (generic function with 2 methods)
julia> f(1, 2)
6
julia> f(1.0, 2.0)
-2.0 |
OK, all clear now. Thanks!! |
We can even use functions with no methods at all, provided the name is defined: julia> function g end
g (generic function with 0 methods)
julia> f(x, y) = 2 * g(x, y)
f (generic function with 1 method)
julia> f(1, 2)
ERROR: MethodError: no method matching g(::Int64, ::Int64)
Stacktrace:
[1] f(x::Int64, y::Int64)
@ Main ./REPL[2]:1
[2] top-level scope
@ REPL[3]:1
julia> g(x, y) = x + y
g (generic function with 1 method)
julia> f(1, 2)
6 This is a useful technique for building up frameworks |
Isn't this method
ParameterEstimocean.jl/src/EnsembleKalmanInversions.jl
Lines 509 to 515 in f939c72
from the
PseudoSteppingSchemes
moduleParameterEstimocean.jl/src/PseudoSteppingSchemes.jl
Line 43 in f939c72
and thus we need to import it?
cc @glwagner, @adelinehillier
The text was updated successfully, but these errors were encountered: