-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Problem
JET.jl reports a world age warning during testing:
WARNING: Detected access to binding `ProbNumDiffEq.sample` in a world prior to its definition world.
Julia 1.12 has introduced more strict world age semantics for global bindings.
!!! This code may malfunction under Revise.
!!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
Root Cause
We have two sample functions defined in different files:
sample(process::AbstractGaussMarkovProcess, times, N=1)insrc/priors/common.jl(line 247)sample(sol::ProbODESolution, n::Int=1)insrc/solution_sampling.jl
During module loading, when the first sample method is defined, code paths that reference sample get compiled. When the second method is added later, this creates a world age boundary issue. The precompilation step in src/precompile.jl likely triggers this by executing code that might indirectly reference sample.
Proposed Solution
Rename one of these functions since they serve fundamentally different purposes:
sample(process::AbstractGaussMarkovProcess, ...)→sample_process(...)ormarginalize_and_sample(...)sample(sol::ProbODESolution, ...)→sample_solution(...)or keep assample
Recommendation: Rename the prior's sample to sample_process since:
- It's the less commonly used function (internal to prior sampling)
- The solution sampling is the user-facing API and should keep the simpler name
- It makes the distinction clearer: sampling from a process vs. sampling solution trajectories
Additional Notes
This issue will become an error (not just a warning) in future Julia versions, so it needs to be fixed.
Metadata
Metadata
Assignees
Labels
No labels