在 rebol 中编写沙盒环境有点像 Spoon.net

发布于 2024-09-14 01:16:17 字数 447 浏览 2 评论 0原文

http://spoon.net 让您可以通过从网络下载桌面应用程序来执行它们。当您退出时,它会恢复系统。

http://askpoweruser.com 我想做同样的事情。我的想法是将整个系统层次结构保留在磁盘上,然后在执行结束时恢复它。

一行代码就足够了(对于如此复杂的功能来说似乎太容易了,这就是我怀疑的原因:)):

save %system.txt system

什么是序列化细化?在这种情况下有用吗?

要恢复系统我会这样做

load %system.txt

http://spoon.net let's you execute desktop application by downloading them from the web. When you quit it restores the system.

On http://askpoweruser.com I'd like to do the same thing. My idea would be to persist the whole system hierarchy on disk and then restore it at the end of execution.

Is a single line of code would be enough (seems like too easy for such complex feature that's why I doubt :)):

save %system.txt system

what is serialize refinement ? would it be usefull in that case ?

to restore system would I then just do

load %system.txt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

江城子 2024-09-21 01:16:17

这是我的目标:

>> o: context [b: "b" f: does [do make function! [] [print ["a"]]] oo: context [a: 1]]
>> ?? o
== o: make object! [
    b: "b"
    f: func [][do make function! [] [print ["a"]]]
    oo: make object! [
        a: 1
    ]
]

更改函数 f 中的某些内容:

>> o/oo/a: 2
>> append second last second first next next next third :o "b"
>> o/f
== a b
>> save/all %t.r :o
>> p: load %t.r
>> ?? p
== p: make object! [
    b: "b"
    f: func [][do make function! [] [print ["a" "b"]]] ;<----
    oo: make object! [
        a: 2              ;<------
    ]
]
>> p/f
== a b ;<----

看起来一切正常。但当然这只是一次测试。

here is my object:

>> o: context [b: "b" f: does [do make function! [] [print ["a"]]] oo: context [a: 1]]
>> ?? o
== o: make object! [
    b: "b"
    f: func [][do make function! [] [print ["a"]]]
    oo: make object! [
        a: 1
    ]
]

change something in function f:

>> o/oo/a: 2
>> append second last second first next next next third :o "b"
>> o/f
== a b
>> save/all %t.r :o
>> p: load %t.r
>> ?? p
== p: make object! [
    b: "b"
    f: func [][do make function! [] [print ["a" "b"]]] ;<----
    oo: make object! [
        a: 2              ;<------
    ]
]
>> p/f
== a b ;<----

it looks everything is ok. But of course this is just a single test.

沒落の蓅哖 2024-09-21 01:16:17

目前您无法像这样保存整个 Rebol 图像。您可以使用“mold/all”序列化 Rebol 值,并使用“save”保存值。但据我所知,序列化不能正确地将函数保存在对象内。

You can't currently save the entire Rebol image like this. You can serialize Rebol values by using 'mold/all and save values by using 'save. But AFAIK the serialization doesn't properly save functions inside objects.

恋你朝朝暮暮 2024-09-21 01:16:17

您可以使用 CryoPID 之类的东西:

http://cryopid.berlios.de/

这将在该过程中起作用级别,你可以用它来做 Rebol 以外的事情。但这是特定于操作系统的。

You could use something like CryoPID:

http://cryopid.berlios.de/

That would work at the process level, and you could use it for things besides Rebol. But it would be OS-specific.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文