Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: to-path newline problem?

From: holger:rebol at: 14-Aug-2001 10:17

On Mon, Aug 13, 2001 at 01:37:41AM -0500, Joel Neely wrote:
> Well, it certainly defies my notion of EQUAL? to say that > one can have two values which are equal but MOLD unequally!
*grin* You stumbled across one of those relatively few, "magic" undocumented features in REBOL :-). Here is the story: 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.
>> a: [12
[ 34 [ ] == [12 34 ]
>> a
== [12 34 ]
>> b: [12 34]
== [12 34]
>> b
== [12 34]
>>
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. -- Holger Kruse [holger--rebol--com]