think again about your original style: objects calling "global" functions. you are on special prototype-oops here. the way "one class per object" is very cool, for me i have a base-class with a 'save -func in, and if i want to change the 'save -behavior i simply change the function (bit binding or obj: make obj[..]). sometimes i use specialised functions with the filename inlined or that. ok, if i save this object, i never want to have the "latest" function. and if you look a bit at javas serialisation and programmers effort to stay compatible to an older class-version :( on the other hand, if i define save-really: func[a][prin[t "i save" mold a]] save-never: func["read-only" a][print ["i save not:)" mold a]] a: make object![ save: func[][save-really self]] b: make object![ save: func[][print "hey! they save me!" save-really self]] i have: individualism if needed, small object, a clean definition of the objects behavior (old objects calls old global 'save, changed 'save gets new name) not perfect in a big programm, but with the usual some handfulls of rebol is quite handy. note too the rebol-way of 'ports : global functions call some specialiced object-functions in a standart way. a global read calls an object's 'open', read-io, 'close . (i think. or is a 'read too defined in a 'port ? at least this way can work?) i use a global 'save-t which formats the text-object if its a rebol-file, then calls the personal 'save . is handy. (if i think the object should format itself, i can ask if it knows this new function, else call the old default. or, easier, simply load the database and add it everywhere, if not too distributed :) so i define global functions which "asks" the object to do special things. the object knows some short control-code, which call the right global functions to do the service. short objects, individual behavior, safe extending. note this is the usual way a os-windows is handled (know all this switch WM_ -stuff? size of this? need of knowledge?) which is the most complex part of a usual program. how easy is this way of "messaging" written in rebol! > Michael Jelinek wrote (in refinements thread): > > I really just want to separate the definition of the method (function > body) from the object, but I still want the method to be called as part of > the object. Some of these objects can be saved to a file and reloaded, and I > want the function "bound" to the latest definition in the program, not what > the definition was at the time that the object was saved. Also, although I > can't claim to "know" the internals of REBOL, I don't want multiple copies > (or worse, definitions) of the function floating around - it's inefficient. > > This is the core of the problem. To have one function per "class" of object, > not one function per instance, for REBOL. This is easily done in C++, not so > easily in REBOL. I'm sure it can be done with some suitably cunning script. > > I'll have to think about it more deeply, after I've done some fiddling. > > Andrew Martin > OO Rebol... > ICQ: 26227169 > http://members.xoom.com/AndrewMartin/ > -><- > > >
