What gives Smalltalk the ability to do image persistence, and why can't languages like Ruby/Python serialize themselves?

后端 未结 4 736
情深已故
情深已故 2021-02-07 04:55

In smalltalk, you\'re able to save the state of the world into an image file. I assume this has to do with Smalltalk\'s ability to \"serialize\" itself -- that is, objects can p

4条回答
  •  你的背包
    2021-02-07 05:54

    This happens already in a way when you put your computer to sleep, right? The kernel writes running programs to disk and loads them up again later? Presumably the kernel could move a running program to a new machine over a network, assuming same architecture on the other end? Java can serialized all objects also because of the JVM, right? Maybe the hurdle is just architecture implying varied memory layouts?

    Edit: But I guess you're interested in using this functionality from the program itself. So I think it's just a matter of implementing the feature in the Python/Ruby interpreter and stdlib, and having some kind of virtual machine if you want to be able to move to a different hardware architecture.

提交回复
热议问题