Types themselves are immutable, right? Don't instances in Julia contain a pointer to their type? If a type's definition were replaced, would the old (now obsolete) instances still point to the old definition? Would they still correctly use methods specialized on the old definition? If so, it seems that you could redefine types without much problem, as long as you didn't expect the old instance's data to be migrated.
I think that would be very useful in the REPL. Often I have lots of data in objects totally unaffected by the type I'm working on, and it's a pain to have to save data, restart, recompile, reload data constantly during development. On Thursday, February 4, 2016 at 1:46:45 PM UTC-5, Michael Landis wrote: > > I think it would be nice to be able to undefine a type, so restarting the > environment is not required when adding or deleting an attribute from a > type description. Not being able to update a type definition without > restarting the environment is a royal pain in the ass. > > On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote: >> >> Suppose I have a Type >> >> type Foo >> a >> b >> end >> >> f = Foo(1,2) >> f.a = 1 >> f.b = 2 >> >> how do I test whether f.a is defined >> I do this isdefined(f, 1) but isdefined(f, 'a') does not work >> >> another question >> how do i undefine f.a such that isdefined(f,1) now returns false >> >