在guile中保存程序映像
我听说大多数 Lisps 支持将正在运行的程序的图像保存到文件中。诡计支持这一点吗?
I've heard that most lisps support saving image of running program into file. Does guile support this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为与其他语言的互操作对于 Guile 来说是不可或缺的,因此解释器图像中有很多状态对于 Guile 本身来说是不透明的。我最了解 Guile 的方式是使用它作为 gEDA 中内置的方案解释器,所以你能想象不仅要保存所有 CONS,还要保存 gschem 可能打开的所有 X 窗口吗?在 Guile 内部可靠地完成任务是不可行的。 (而且我不确定即使在“有限”的情况下实现“将图像保存到文件”是否是一个好主意。)
也就是说,最终您可以保存程序状态,但由于程序边界是如此多孔,随着文件描述符和内存映射从每个毛孔中泄漏出来,您很快就会意识到必须保存整个计算机的状态。但这是以“休眠”省电模式的形式完成的!我也意识到这不是你想要的。
I think that interoperating with other languages is pretty integral to what Guile is, and so there is a lot of state in an interpreter image that is opaque to Guile itself. I know Guile best from working with it as the scheme interpreter built into gEDA, so can you imagine having to save not just all the CONSes, but also all the X windows that gschem might have open? It just isn't feasible to do reliably from within Guile. (And I'm not sure it would be a good idea to implement save-image-to-file even in "limited" cases.)
That said, ultimately you can save the program state, but since the program boundaries are so porous, what with file descriptors and memory maps leaking out of every pore, you soon realize that you have to save the entire computer's state. This is done though, in the form of the "hibernate" power-saving mode! I realize, too, that that isn't what you want here.
SBCL(Common Lisp 的一个实现)可以做到这一点。 (另请参阅简短的 SBCL 教程)。如果您有兴趣探索其他可以保存和恢复系统状态的动态语言(包括延续、打开文件描述符或其他),请查看 吱吱。
SBCL, an implementation of Common Lisp, can do this. (Also see this short SBCL tutorial). If you are interested in exploring other dynamic languages that can save and restore the system state (including continuations, open file descriptors or whatever), have a look at Squeak.