[REBOL] Re: Rebol pickling recipes ?
From: g:santilli:tiscalinet:it at: 5-Oct-2002 12:12
Hi Laurent,
On Friday, October 4, 2002, 11:03:04 PM, you wrote:
LG> So reading your answer I wonder if this applies to objects printed with 'mold ?
LG> Is it possible for such objects to contain a different content when loaded back
LG> into a different context than the one they were "saved" from ?
Yes, it is.
LG> And if this possible context "confusion" exists is there any way to make sure
LG> that objects are saved along with all the necessary context ?
Well, with a lot of effort, you could do it, but you'd probably
end up MOLDing the whole system.
LG> Also I did not manage to see what was exactly the difference beetween doing "do
LG> load mold/all" and simply doing "do load mold" in your example.
The difference is between LOAD MOLD/ALL and DO MOLD (i.e. you need
to evaluate in the latter). Also, consider the following:
>> b: reduce [make object! [a: 1 b: 2] true none make hash! [1 2 3 4]]
== [
make object! [
a: 1
b: 2
] true none make hash! [1 2 3 4]]
>> length? b
== 4
>> foreach element b [print type? element]
object
logic
none
hash
>> b': load mold b
== [
make object! [
a: 1
b: 2
] true none make hash! [1 2 3 4]]
>> length? b'
== 8
>> foreach element b' [print type? element]
word
word
block
word
word
word
word
block
>> b'': load mold/all b
== [
make object! [
a: 1
b: 2
] true none make hash! [1 2 3 4]]
>> length? b''
== 4
>> foreach element b'' [print type? element]
object
logic
none
hash
HTH,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r