The semantics of TO and MAKE and TO STRING! etc. have always been fuzzy.
The new operation in Ren-C AS lets you change the "view" of the underlying data of a word or string. So if you say t: <tag> | s: as string! t | append s "-string" you will get t as <tag-string> and s as "tag-string".
That suggests that copy as word! <a> would be able to give you the independent word a. (This would be the competing potential meaning for to-word <a>). This is currently technically impossible since ANY-WORD! uses UTF-8 and ANY-STRING! uses either Latin-1 or UCS-2, so they can't image each other. But the plan is that they will be compatible (even if that means having 3 or more underlying formats for both. :-/)
But the slippery slope here might say that if anything isn't a WORD!, then the TO WORD! of it would be the string representation. Should to word! quote foo: give you a word with a colon at the end, because it does to word! to string! quote foo:?
It's not a bad answer IMO, and many cases of TO WORD! should probably be AS WORD!. But it would break a lot of existing code if TO-WORD between various word types used their stringification with their markup characters. :-(
So it is a thinking point just in the big questions of what TO means.
Hostilefork mentioned this issue on Jan 17, 2017:
TO-WORD tag
Submitted by: Hostilefork
From @giuliolunati:
Imported from: https://github.com/rebol/rebol-issues/issues/2268
Comments:
The semantics of TO and MAKE and TO STRING! etc. have always been fuzzy.
The new operation in Ren-C AS lets you change the "view" of the underlying data of a word or string. So if you say
t: <tag> | s: as string! t | append s "-string"
you will get t as<tag-string>
and s as"tag-string"
.That suggests that
copy as word! <a>
would be able to give you the independent worda
. (This would be the competing potential meaning forto-word <a>
). This is currently technically impossible since ANY-WORD! uses UTF-8 and ANY-STRING! uses either Latin-1 or UCS-2, so they can't image each other. But the plan is that they will be compatible (even if that means having 3 or more underlying formats for both. :-/)But the slippery slope here might say that if anything isn't a WORD!, then the TO WORD! of it would be the string representation. Should to word! quote foo: give you a word with a colon at the end, because it does to word! to string! quote foo:?
It's not a bad answer IMO, and many cases of TO WORD! should probably be AS WORD!. But it would break a lot of existing code if TO-WORD between various word types used their stringification with their markup characters. :-(
So it is a thinking point just in the big questions of what TO means.