Allowing any value to be escaped an arbitrary number of times came up a couple of years ago. At the time it was called "lit bit"...the idea that any value could carry the literal bit. LIT-INTEGER!, LIT-BLOCK!, etc.
This took for granted the idea that calling these "literals" was a good idea in the first place. But in Rebol, what's a "literal" anyway? In the following code:
data: [1 foo [?]]
bar: third data
Isn't the 1 a "literal integer"? Isn't foo a "literal word"? Aren't [1 foo [?]] and [?] examples of "literal blocks"?
They are certainly acting that way in the sense most programming languages would refer to "literals". Says the all-knowing Wikipedia:
In contrast to literals, variables or constants are symbols that can take on one of a class of fixed values, the constant being constrained not to change. Literals are often used to initialize variables, for example, in the following, 1 is an integer literal and the three letter string in "cat" is a string literal:
int a = 1; string s = "cat";
Should we call backslashes escaped values?
I was thinking about a reflector to tell you how many backslashes something had, and I kind of liked escapes of.
>> escapes of quote \\\"cat"
== 3 // no evaluation due to quote
>> escapes of \\\"cat"
== 2 ; evaluation peels one escape off
>> escapes of "cat"
== 0 -- yes, I'm demonstrating comment alternatives
If we did so, then the operation might be called "escape" instead of "lit" or "literal":
>> escape escape "cat"
== \\"cat"
>> escape/depth "cat" 5
== \\\\\"cat"
That conflicts with the name for the ASCII character code. But this could be resolved as was done with NULL being changed to NUL to avoid a conflict. ESCAPE the CHAR! could just become ESC, which is an industry-standard notation.
Conflict in API shorthands, rebE() ?
In the giant universe of concerns, one is that ESCAPE and EVAL start with the same letter. This is unfortunate, since indicating you want an API value to be evaluated is done with rebE()
:
Previously, asking for "escaping" was done with rebUneval
, a.k.a. rebU()
.
How does unevals of \\\"cat"
and uneval "cat"
sound? I think it's kind of presumptive . Who said you were ever going to evaluate it? It's a property of the value, you could use it for whatever dialected meaning you like--evaluation isn't the only reason.
There's nothing wrong with having UNEVAL be a synonym for ESCAPE, which helps indicate situations where that's why you are escaping it. It's commentary.
Calling it backslashes of treads into some kind of absurdism. It would be like calling [...] a BRACK! (or (...)
a PAREN!)
Should we just accept the abuse of the term LITERAL! ?
I've aired my grievance that I think 1
is a literal integer, and \1
is explicitly not a literal integer. I have sort of a gut feeling that going against the standard terminology in languages--of "escaping"--and using another standard term wrongly, will bite us.
But LIT is a short word:
switch type of quote \\\[1 + 2] [
lit lit lit block! [ -- can't say \\\block!, that's word not datatype
print ["Is there any better way to say this?"]
]
...
]
And we can call the reflector that counts them lits of, I guess. But that feels kind of... il-LIT-erate.
I'm hammering through the mechanics, but the terminology needs help, so please chime in.