julia
214e69d8 - InteractiveUtils: access bindings in fixed world

Commit
61 days ago
InteractiveUtils: access bindings in fixed world InteractiveUtils provides a number of utilities for querying and accessing the contents of modules. Because these modules can gain new bindings, some callers of InteractiveUtils functions produce warnings WARNING: Detected access to binding ... prior to its definition world. One dramatic example occurs with the sequence using OptimizationProblems: OptimizationProblems using OptimizationProblems.ADNLPProblems using ADNLPModels: ADNLPModel when running with Revise. ADNLPProblems loads new problems via Requires, and starting with v3.13 Revise queries `InteractiveUtils.subtypes` to cache dependent fieldtypes. This triggers the warning. To fix this, add `defined_since` and `world` keyword arguments to `names`/`unsorted_names` to filter the returned names by world age. These are then threaded through `varinfo`, `methodswith`, and `subtypes` in InteractiveUtils so they operate on bindings in the correct world. The defaults for `defined_since` and `world` kwargs are set to preserve the current behavior. Revise will be able to eliminate the warnings by passing `world=Base.tls_world_age()` to `subtypes`. Related: https://github.com/timholy/Revise.jl/issues/993 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Committer
Parents
Loading