I understand that we can’t delete existing bindings or redefine structs without replacing the entire module. Is there a way of reinitializing the Main
module without having to close the REPL?
is there some particular use case that Revise.jl doesn’t cover?
Sorry, I do not understand what you mean by reinitializing the Main
module, what exactly this would consist of?
Revise doesn’t allow redefining structs in Main
, unlike in modules. I guess that might be an inconvenience?
julia> using Revise
julia> struct abc end
julia> struct abc{T}
x :: T
end
ERROR: invalid redefinition of constant abc
julia> module temp
struct abc end
end
Main.temp
julia> module temp
struct abc{T}
x :: T
end
end
WARNING: replacing module temp.
Main.temp
https://github.com/JuliaLang/julia/pull/33872 makes this pretty easy to implement (https://github.com/JuliaLang/julia/pull/33872#issuecomment-703260632).
Yes, I’m mostly looking for an easy way to edit structs when working in projects.
If you haven’t decided on how your struct should look, consider using a NamedTuple until the layout is finalized and then switch to a struct. They work with Revise and you can explore to your hearts content.
Removing all user-defined variables