seems i cannot force a "^/rebol" with block-changing.
but i can if i construct a block from a string, and insert it.
>> a: "[a [ b^/ rebol[]]]"
== "[a [ b^/ rebol[]]]" ; string!
>> a: to block! a
== [[a [b
. rebol []]]] ; block!
>> b: [before after]
== [before after] ; block!
>> insert next b a
== [after] ; block!
>> b
== [before [a [b
. rebol []]] after] ; block!
>> save %test.txt b
>> print read %test.txt
before [a [b
. rebol []]] after
>> load %test.txt
** Syntax Error: Missing [ at end-of-block.
** Where: (line 2) before [a [b
what if i handle data this way?
maybe guestbook, and someone says
"Very funny! try this too! ^/REBOL[ ] ... "
can the "nice notes" - database go down?
Well, ok, nobody will store long strings with 'save today,
but if this "{}"-bug is fixed, is 'save really save?
>> save %test.txt { aaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa
>> print read %test.txt
{ aaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa
. rebol[]
}
>> load %test.txt
** Syntax Error: Invalid string -- }.
** Where: (line 3) }
the "{}"-Bug can be fixed with replacing by "^(7B)",
but how to fix this header-think?
lots of exceptions without LOAD/NEXT/DATA
And then, if someone like me picks a piece of code from a
well formattet source by own code or two load/next,
will he expect this can "insert" a header?
is it ok when a well debugged programm fails weeks ago
because of a not very obvious feature?
Or i'm the great exception doing stuff like this?
maybe i have to go to load/header with all the extra work
(header is a object with all fields, i have to make it a block,
throw away the "none"-fields..), because writing a stamp-function
is a very rare situation? :)
i would prefer a feature-disabler like load/data, because
load/next with all the nesting-handling is handy.
Hm. Seems i'm a bit angry about my mistake. but .. :)
I was very impressed with this persistence of rebol.
if data is organized in blocks without cycles,
i need a single command like the hyperclever other systems.
But i get readable text. And no trouble when i change a little
bit of code, nobody says "wrong class version".
Then my first "Application" crasht an MB and a week later
because someone used "{}" wrong in his email,
and then my stamp was not fully trustable..
BTW, a little trace/docu-tool. looks like entered all by hand :) call
do-demo[
1 + 2
]
or
func[]t-t[ 1 + 3 ]
do-demo: func[a /local b c d e f g][
while [not tail? a] [
c: a
d: mold c
if not parse/all d [thru "^/" copy c to "^/" to end] ;experimental
[c: d]
print [">>" c]
set/any [b a] do/next a if value? 'b [
e: mold :b
if parse/all e
[g: thru "^/" thru "^/" thru "^/" thru "^/" to "^/" f: to end]
[e: join copy/part g f "..."]
print ["== " e " ; " mold type? :b ]] ]
either value? 'b [:b][]
]
top-trace: func[a][compose/deep[do-demo [ (a) ]]]
t-t: :top-trace
Volker
------------
jeff wrote:
>
> References: <[EMAIL PROTECTED]>
>
>
> Howdy Gabriele, agem:
>
>
> Load/next will only skip past a REBOL header when it
> sees something like this:
>
> { something something ^/REBOL []}
>
> If you have a block like this:
>
> [something something rebol []]
>
> and you SAVE it, you won't wind up with "REBOL []"
> preceded by a newline, so it will LOAD/next back in as
> you like, an element at a time. Also, you can always
> TRIM/lines other strings that you want to LOAD/next if
> you suspect there may be REBOL headers within the
> string.
>
> -jeff
>
>