Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Storing/loading object functions

From: antonr:iinet:au at: 7-Dec-2003 22:38

I was about to say I found a nice way, but the following leads to a mold bug, which I mention in previous email:
>> prototype: make object! [a: 23 class: none do [class: self]] >> o: make prototype [a: 42] >> o/class/a
== 23
>> o: make prototype [a: 83] >> o/class/a
== 23
>> o/a
== 83 So you could iterate through all your objects, collecting a list of "classes" (eg. reference to prototype), then, save those "base class" objects, including the functions. Other, derived objects should have the functions clipped away. We're assuming that they are all just copies of the prototype's functions anyway.. That works as long as the derived objects do not modify/redefine the inherited functions, of course. After reading Volker's answer I think he is right about using a string for the class name, for serialisation to db. Anton.