Yes, possibly a bug.  The wierd thing is that it works
as I expect when the variable assignment is added (sprops: )
to the save.

But I see what you mean about load/save and that load always 
puts a block around the data so I should always be ok.

Thanks a lot for your help!

Rodney


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 03, 2000 4:09 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Rebol Config/INI File Difficulty Re:(3)



very confusing. maybe a bug?! ;-) some while later..

if not, note 'save is paired with 'load .
in the saved file there are no brackets around, as in
   save/header %out.dat sprops []
but after loading you have all in a block again.
so you can do
sprops: LOAD %in.dat

this seems to work ok too:
save/header %out.dat compose/deep [ sprops: [(sprops)] ] []
instead of:
save/header %out.dat compose/deep [ [(sprops)] ] []
evil magic :)

you wanted a "sprops:" in your save for doing, hopefully?

[REBOL [title: "the save/load - demo"]
    pdo: func [a] [print ">>>" probe a print "===" do a]

    write %in.dat {
REBOL []
sprops: [ 1 [ a ] 2 ]
}

    pdo[print read %in.dat]

    pdo [sprops: do %in.dat
        ?? sprops]

    pdo [save/header %out.dat sprops []
        print read %out.dat
        print "---"
        probe load %out.dat
    ]

    pdo [save/header %out.dat compose/deep [sprops: [(sprops)]] []
        print read %out.dat
        print "---"
        probe load %out.dat
    ]

]

--- [EMAIL PROTECTED] wrote at 3-Aug-2000/9:24:35-7:00
> Thanks for the 'compose lesson.  I've never had to use it.
> I can get something close to what I want, but I still am having
> trouble getting the following to work.
> 
> Here is one file %in.dat:
> 
> REBOL []
> [
> ss
> [
>   item1 "hello"
>   item2 "goodbye"
> ]
> 
> other
> [
>   n "bad"
> ]
> ]
> 
> 
> 
> Fine.  Now a console session....
> 
> >> sprops: do %in.dat
> == [
>     ss
>     [
>         item1 "hello"
>         item2 "goodbye"
>     ]
>     other
>     [
>         n "bad"
>     ]
> ]
> 
> >>save/header %out.dat sprops []
> 
> Here is what %out.dat then contains:
> 
> REBOL []
> 
> ss 
> [
>     item1 "hello" 
>     item2 "goodbye"
> ] 
> other 
> [
>     n "bad"
> ]
> 
> Not what I want.  I want (expect) to see exactly what is in
> the file %in.dat.  So I say, OK, use compose/deep to enclose
> the thing in a block.  The following:
> 
> >>save/header %out.dat compose/deep [(sprops)] []
> 
> gives the same %out.dat as before.  And this:
> 
> >>save/header %out.dat compose/deep [[(sprops)]] []
> 
> makes %out.dat look like the following:
> 
> REBOL []
> [[
>         ss 
>         [
>             item1 "hello" 
>             item2 "goodbye"
>         ] 
>         other 
>         [
>             n "bad"
>         ]]]
> 
> As you can see there are is now an extra enclosing block instead of just
> one!!!
> 
> How do I save sprops, which has the exact form I want, to %out.dat so it
> looks exactly like %in.dat???
> 
> TIA,
> 
> Rodney
> 

Volker

Reply via email to