是什么赋予Smalltalk进行图像持久化的能力,以及为什么Ruby/Python之类的语言无法序列化自身? [英] What gives Smalltalk the ability to do image persistence, and why can't languages like Ruby/Python serialize themselves?

查看:83
本文介绍了是什么赋予Smalltalk进行图像持久化的能力,以及为什么Ruby/Python之类的语言无法序列化自身?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在smalltalk中,您可以将世界状态保存到图像文件中.我认为这与Smalltalk自身序列化"的能力有关-也就是说,对象可以产生自己的源代码.

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 produce their own source code.

1)这是一个准确的理解吗?

1) Is this an accurate understanding?

2)将这种功能添加到现代语言(显然不是lisp)会面临什么挑战?

2) What is the challenge in adding this ability to modern languages (non-lisp, obviously)?

3)序列化"是正确的词吗?什么是正确的行话?

3) Is "serialization" the right word? What's the correct jargon?

推荐答案

比序列化"简单得多. Smalltalk映像只是对象内存的快照.它获取整个RAM内容(在垃圾回收之后)并将其转储到文件中.在启动时,它将快照从磁盘加载到RAM并从中断处继续处理.有一些挂钩可以对快照和恢复快照执行特殊操作,但是基本上这是它的工作原理.

It's much simpler than "serializing". A Smalltalk image is simply a snapshot of the object memory. It takes the whole RAM contents (after garbage collecting) and dumps it into a file. On startup, it loads that snapshot from disk into RAM and continues processing where it left off. There are some hooks to perform special actions on snapshot and when resuming, but basically this is how it works.

(添加:请参见下面的Lukas Renggli的评论,以获取比其他环境更简单的关键设计选择)

(added: see Lukas Renggli's comment below for a crucial design choice that makes it so simple compared to other environments)

这篇关于是什么赋予Smalltalk进行图像持久化的能力,以及为什么Ruby/Python之类的语言无法序列化自身?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆