I'm pleased to say that the day has come that you can use apostrophe to escape any value...not just WORD! and PATH!. And since I said any value, that means you can also quote quoted values...as deeply as you like!
>> '(1 + 2)
== (1 + 2)
>> ''(1 + 2)
== '(1 + 2)
>> quoted? first [''{double quoted text!}]
== #[true]
>> quotes of first ['''''''''''''''''<whoa!>]
== 17
It opens up a whole new box of parts for dialecting, and makes your every day code shorter and clearer (when used properly). But don't be fooled by the fact that you can use a stupid number of quotes if you need: This isn't a frivolous thing, and being able to truly escape any value--hence including any quoted value--is integral to the feature.
If you are a heavy user of COMPOSE-ing code and then DO-ing it, you would be more likely to appreciate the efficiency and literacy of:
do compose [... some-var: '(foo) ...]
But what you realize if you program at the API level (like C or JavaScript) is that every execution acts like "a do of a COMPOSE". Since API representations of values spliced in from non-Rebol code are not fetched through a WORD!, libRebol users wind up putting "QUOTE" (now THE) calls everywhere--slowing things down, junking it up, and fundamentally changing the types and shape of what you're working with. If you write sophisticated enough Rebol routines you've almost certainly run up against this problem too--but it's an issue on nearly every call into the API.
Be warned, this is a radical change!
I'm sure you'll love it when all is said and done. But it changes the typeclass membership of LIT-WORD! and LIT-PATH!. They are no longer ANY-WORD! or ANY-PATH!, but instances of a new fully generalized quoted type. This will cause some speedbumps.
Since you could do things like GET on a LIT-WORD!, or APPEND to a LIT-PATH!, I've tried to set up some mechanisms for the cases I thought of. I even threw in some new weirder ones, like letting you add directly to a quoted integer and get a quoted integer at the same level back:
>> add the '''''1 2
== '''''3
I didn't see a good general rule for this. It seems FIND on a quoted BLOCK! should return a position in the quoted block that is still quoted. But SELECTing or PICKing a value out of the block should ignore the container's quoting. It just seems like it has to be done on a case-by-case basis, for the semantics that make sense for the operation.
Basic Mechanics
To get the number of quote levels, use QUOTES OF. To get rid of any quoting present on any value, use NOQUOTE.
>> quotes of first ['''{triply quoted string}]
== 3
>> noquote first ['''<some-tag>]
== <some-tag>
All that happens with multiply quoted types is that each time the evaluator sees it, it will peel off one quote level:
>> ''(1 + 2)
== '(1 + 2)
>> '(1 + 2)
== (1 + 2)
>> (1 + 2)
== 3
This means inert types which are singly quoted get evaluated and lose the distinction from the plain inert type. So if you have a function that takes an evaluated argument (e.g. foo: func [x] [...]) you can't provide special behavior for foo '[block]
that is different from foo [block]
. The only way a called function will see the bit is if it quotes the argument, or if it's inside a dialect block (like a PARSE rule).
You can, however, get special behavior for foo ''[block]
, as it will receive a singly quoted block as an argument. And of course, it's now more practical to escape GROUP!s, so it might be worth it to start defining distinct behavior when groups are used since they'll be so easy to pass! (I have some ideas about this.)
Name Switcheroo: QUOTE => THE
QUOTE now adds a quoting level to whatever it gets as an argument, with that argument being evaluated normally:
>> x: 1
== 1
>> quote x
== '1
>> the x
== x