[REBOL] How do I separate program from data
From: bobr::dprc::net at: 22-Sep-2000 20:55
As I was examining the great discussion
on Associative data storage
I got to thinking how nice it would be to have a bit more control
over exactly what functions were stored when an object was saved and
what was used to recreate the object when it came back and was reloaded.
In more traditional terms, I want to save the data only and not the functions.
In a more realistic case, I want to save only certain functions.
The remainder are not exported because :
- they only matter to the app that did the save
(and not to the one which does a load)
- I want to be free to change the implementation
between save and subsequent reload
- I cannot afford the disk space overhead related to
saving all the functions with the object [particularly
when this type of object! might appear multiple times
in millions of files.
Ideally, I would like to change the datatype emitted when
an object is saved to be something defined by the object.
[for instance if the object has a /type? refinement ]
This way when I recreate the object! later by loading it
I can perhaps have "different" (read as "additional")
functions defined for the spec or data that is saved.
Instead of seeing " make object! [" in the save file
I want to see " make assocDS! [" or similar in the save file.
Naturally I have a way to do so in my mind already
but I want to open up discussion to you
creative types (you know who you are).
I invite solutions that:
- run with the current version of Rebol/core
- do not save functions that start with a prefix I pick (such as _internal )
- work with 'save and 'mold
- it is ok to displace 'save or 'mold either temporarily
or permanently with a replacement that calls the original.
- "make assocDS! [" appears even
if the assocDS! is not at the outer levels, but is instead
in a deeper part of the structure, perhaps multiple times.
(can't just call mold and replace every occurrance of object! )