[ANN] Revise.jl v3.13: Struct revision support

Happy New Year, everyone!:tada::pine_decoration:

A new year’s gift for you all: Revise.jl v3.13 with struct revision support.
Here’s what’s new in this release.

Struct Revision (Julia 1.12+)

Revise can now handle changes to struct definitions! When you modify a struct, Revise automatically re-evaluates the struct definition along with any methods or types that depend on it.

For example, if you have:

struct Inner
    value::Int
end

struct Outer
    inner::Inner
end

print_value(o::Outer) = println(o.inner.value)

And change Inner to:

struct Inner
    value::Float64
    name::String
end

Revise will redefine Inner, and also re-evaluate Outer (which uses Inner as a field type) and print_value (which references Outer in its signature).

See PR #894 for implementation details.

Limitations: Binding revision is not yet supported

While struct revision is supported, more general “binding revision” is not yet implemented. Specifically, Revise does not track implicit dependencies between top-level bindings.

For example:

MyVecType{T} = Vector{T}  # changing this to AbstractVector{T} won't update MyVec
struct MyVec{T}
    v::MyVecType{T}
end

If you change MyVecType{T} from Vector{T} to AbstractVector{T}, the struct MyVec will not be automatically re-evaluated because Revise does not track the dependency edge from MyVecType to MyVec. The same applies to const bindings and other global bindings that are referenced in type definitions.

This limitation actually also affects macros and generated functions—if you change a macro definition, the changes won’t propagate to code that has already expanded that macro.

Workaround: You can manually call revise(MyModule) to force re-evaluation of all definitions in MyModule, which will pick up the new bindings.

Supporting general binding revision would require tracking implicit binding edges across all top-level code, which involves significant interpreter enhancements. This is deferred to future work.


Other Changes

Added

  • Revise.dont_watch(pkg) and Revise.allow_watch(pkg) functions with Preferences.jl persistence. Direct modification of dont_watch_pkgs set is deprecated and will be removed in a future major version. (#976)

Changed

  • Revise.silence() now uses Preferences.jl for persistent storage instead of file-based persistence. (#976)
  • Removed unused Requires and Unicode dependencies. (#977)
  • Internal code quality improvements (#979, #980, #981, #982)

Fixed


For more details, see the documentation.

35 Likes