The main issue is i need to change the definition of struct very frequently when developing my package, but revise cannot deal with that, which is a known limitation of Revise.jl.
So everytime I changed something with my struct, i have to restart julia, ]activate . , using Pluto, Pluto.run(), which is pretty an annoying process. I also did some reading in discourse, and it seems that there isn’t a good solution for that yet, maybe i missed something?
But I did some experinment with Pluto, and I found that, if I define some struct in a cell, and add some methods to that struct, I can actually change the struct definition in the original cell, and the struct is properly changed, without any issue, no restart needed. Even const variable in cell can be deleted and “redefined”.
But I cannot delete the “using MyPkg” cell, and add it back, to make it reload properly. there will be errors showing: “MethodError: no method matching MyStruct”.
So I have a strange idea, if pluto could add a devimport(“MyPkg”) function(whatever name is ok), which is equivelent from copy and paste things from MyPkg into a lot of hidden cells, so everytime i change the struct definition, it’s like changing content in a cell, and everything just works.
This doesn’t need to change anything of the language itself, or add scaffolding macros to the code which should be deleted later, or keeps renaming struct names.
Seem like a good workaround for package developing for me…
Or could revise use the mechenism behind pluto to make struct also reviseble?
So is this idea possible?
If it’s not possible, what’s your practice when you need to change struct definition when developing a package?
I need to use pluto because my package testing involve a lot of visualization and interaction, i cannot do it in repl.
Or if everything above failed, how can i clean my pluto environment within my pluto notebook without restarting everything?(I tried using the stop button and restart, that doesn’t fix the module struct redifinition problem) I heard about workspace or reload function in old version of julia but not anymore.