What does Lisp do with objects created at the REPL? E.g., typeof(a)
. Those objects may not have the data needed to “convert” them to a new type.
Not easily. I think it’s still worth thinking about, but probably an easier solution would be to define new gensymmed type names and have some sort of autoreplacement. A sketch might be
Tnew = gensym(Told.name.name)
mths = methodswith(Told)
for m in mths
Core.eval(m.mod, replacesym!(definition(m), Told=>Tnew)
Base.delete_method(m)
end
Core.eval(mod_of_struct, replacesym!(struct_expr, Told=>Tnew))
together with a call to replacesym!
in Revise’s REPL loop. Would make a great PR for someone interested in learning a bit more about Revise’s internals!