Why can't modern languages (like ruby) serialize themselves like smalltalk?
2 comments
1) No. The object-as-sources ("storeString") is very slow an has many negative effects. E.g. the result is a large string, you need the compiler for de-serialization... all in all, if you look at current Smalltalks, this feature is not used too much.
Saving the whole state of the world to an image is not implemented by using #storeString. Instead it saves the whole heap of the vm to a file. Very fast, but of course this means that the resulting file is specific for 32bit vs. 64bit, endianess... and, very important, object layout (Object Headers are saved as they are in memory). So it is not really serialisation in the classic meaning of the word.
2) Implementing storeString like in Smalltalk needs some reflective features, e.g. enumerating instance variables, setting instance variables after creating new objects when recreating. And the compiler needs to be part of the language, as the string is one huge Smalltalk expression.
3) For image snapshotting serialization is not really the correct term. The memory is just written from RAM to Disk. For #storeString, yes, this is serialization.
For more infos about a modern binary serializer for Smalltalk, see Fuel: http://rmod.lille.inria.fr/web/pier/software/Fuel
Saving the whole state of the world to an image is not implemented by using #storeString. Instead it saves the whole heap of the vm to a file. Very fast, but of course this means that the resulting file is specific for 32bit vs. 64bit, endianess... and, very important, object layout (Object Headers are saved as they are in memory). So it is not really serialisation in the classic meaning of the word.
2) Implementing storeString like in Smalltalk needs some reflective features, e.g. enumerating instance variables, setting instance variables after creating new objects when recreating. And the compiler needs to be part of the language, as the string is one huge Smalltalk expression.
3) For image snapshotting serialization is not really the correct term. The memory is just written from RAM to Disk. For #storeString, yes, this is serialization.
For more infos about a modern binary serializer for Smalltalk, see Fuel: http://rmod.lille.inria.fr/web/pier/software/Fuel
Explained briefly at http://en.wikipedia.org/wiki/Smalltalk#Image-based_persisten...
1) Is this an accurate understanding?
2) What is the challenge in adding this ability to modern languages (non-lisp, obviously)?
3) Is "serialization" the right word? What's the correct jargon?