[REBOL] Re: to-path newline problem?
From: joel:neely:fedex at: 14-Aug-2001 13:07
Holger Kruse wrote:
> When REBOL loads a script and saves or molds it back, it attempts
> to preserve the positions of line feeds in each block, to make the
> output look closer to the original. This is very useful, e.g., for
> structured configuration files.
It just seems that this is a case of the tail wagging the dog. I
can see the benefit of doing so in a few rare cases, but always???
It seems rather analogous to LOAD vs. LOAD/MARKUP, where the
unusual (or more complex) case is signalled by the presence of a
> Internally in REBOL, paths are very similar to blocks. They are
> both subtypes of any-block!. That's why converting a block which
> has those "line feed hints" in it to a path preserves the hints,
> and why molding such a path reproduces them in the output as well.
> At the moment it is not possible to manipulate the line feed hints
> from the REBOL level. This is planned for a future version. Copying
> values to a new block resets the hints though.
How? Any standard way of simply "copying values" that I can think
of doesn't do the trick (except for discarding the last "hint").
>> b: [
>> b1: copy b print mold b1
>> b2: copy/deep print mold b2
>> b3:  foreach be b [append b3 be] print mold b3
>> b4: compose [(b)] print mold b4
Of course one can always do something like
>> b5:  foreach be b [append b5 0 + be] print mold b5
[1 4 16]
but that is hardly the same as simply copying, as it requires
knowing an operator and identity element suitable for the
type(s) of the values in the block!
Any suggestions welcome!
This sentence contradicts itself -- no actually it doesn't.
-- Doug Hofstadter