[REBOL] Re: Rebol pickling recipes ?
From: lmecir:mbox:vol:cz at: 7-Oct-2002 9:21
Hi Laurent,
> What exactly do you mean by "loading" words without using 'load ?
As I see it, Gabriele meant, that you can make a word without using LOAD as
follows:
a-word: first make block! "xxxyyy"
probe a-word ; xxxyyy
The word we made this way cannot be found in REBOL/WORDS:
in rebol/words a-word ; == none
> LG>> If I am right this would allow a kind of persistent rebol environment
: 'molding
> LG>> system before quitting and 'loading it a few days later and finding
the
> LG>> environment exactly in the same state. That could have many
applications.
> > That's what you get with FORTH. I don't think it is possible in
> > REBOL in the general case, but you could do it "partially".
>
> I guess that by "partially" you mean "only for the context that your
script(s)
> have knowledge of" ?
> Would that mean that, for example, one would have to store all code and
data
> within a single object to make sure everything he needs is correctly
restored
> (puting aside the need to handle circular references properly) ?
Not exactly. Let's see this:
block1: reduce [a-word] ; == [xxxyyy]
block2: compose/deep [[(a-word)]] ; == [[xxxyyy]]
block3: reduce [first use block1 block2 first use block1 block2]
set first block3 1
set second block3 2
Now we can explore the properties of BLOCK3:
probe block3 ; == [xxxyyy xxxyyy]
reduce block3 ; == [1 2]
Let's suppose, that we just use the MOLD function to make BLOCK3 persistent.
If we LOAD the result back, we don't get a block having the same properties
as BLOCK3 and that is the trouble.
Regards
-Ladislav