Including the proposal of Oldes/Rebol-issues#2196 with caret-escape spaced, there are three main things you might want to do in a string conversion:
* Get the "spelling" of the token without markup
* Get the version with the markers on it
* Get a LOADable version back
Today this isn't divided very cleanly, except that the 3rd version is ostensibly done with MOLD (which is broken, e.g. mold/all reverse http://hostilefork.com, which cannot LOAD in properly because it doesn't use construction syntax).
I propose that TO STRING! (and hence TO-STRING, the abbreviation for that) include the markings of things, while SPELLING-OF would not:
>> to-string quote set-word^_with^spaces:
== "set-word with spaces:"
>> spelling-of quote set-word^_with^_spaces:
== "set-word with spaces"
With this change, there is no need for FORM...as TO-STRING takes the place and is a much clearer term. (FORM suggests some kind of user interface FORM vs. a string conversion.)
SPELLING-OF would work on ANY-STRING! types like FILE! and TAG! by giving the version without the delimiters, while TO-STRING would include them if they were appropriate.
>> spelling-of <some tag>
== "some tag"
>> to-string <some tag>
== "<some tag>"
>> spelling-of %/foo/bar
== /foo/bar
>> to-string %/foo/bar
== /foo/bar
TO-STRING of BLOCK! could work as a modified variation of FORM. It would recursively run TO-STRING on its contents, and include the outer block delimiters:
This has seemed to be the most useful behavior for the stringification of unevaluated content, which is different from COMBINE. The idea that the blocks represent something visually important that is to be preserved in the "stringification" seems to be more sensible than flattening.
This may suggest that SPELLING-OF work, but just not include the outer delimiters.
Submitted by: fork
Including the proposal of Oldes/Rebol-issues#2196 with caret-escape spaced, there are three main things you might want to do in a string conversion:
Today this isn't divided very cleanly, except that the 3rd version is ostensibly done with MOLD (which is broken, e.g.
mold/all reverse http://hostilefork.com
, which cannot LOAD in properly because it doesn't use construction syntax).I propose that TO STRING! (and hence TO-STRING, the abbreviation for that) include the markings of things, while SPELLING-OF would not:
With this change, there is no need for FORM...as TO-STRING takes the place and is a much clearer term. (FORM suggests some kind of user interface FORM vs. a string conversion.)
SPELLING-OF would work on ANY-STRING! types like FILE! and TAG! by giving the version without the delimiters, while TO-STRING would include them if they were appropriate.
TO-STRING of BLOCK! could work as a modified variation of FORM. It would recursively run TO-STRING on its contents, and include the outer block delimiters:
This has seemed to be the most useful behavior for the stringification of unevaluated content, which is different from COMBINE. The idea that the blocks represent something visually important that is to be preserved in the "stringification" seems to be more sensible than flattening.
This may suggest that SPELLING-OF work, but just not include the outer delimiters.
Imported from: CureCode [ Version: r3 master Type: Wish Platform: All Category: Unspecified Reproduce: Always Fixed-in:none ] Imported from: https://github.com/rebol/rebol-issues/issues/2199
Comments: