Because I want to really be throwing Ren-C up against non-trivial examples, I thought I'd give this a shot.
My first draft actually seemed to work pretty well!
It uses the fledgling ability to turn a block of code into a FRAME!. It needs some work, but it's reasonably all right:
>> parameters of :match
== [test value]
>> make frame! make varargs! [match integer!]
== make frame! [
return: '
test: #[datatype! integer!]
value: ~end~
]
If you notice something interesting there, when you tried to MAKE FRAME! on an "incomplete sentence" it didn't give you an error in the moment. Instead, it gave you a frame with an ~end~ isotope in the missing slot.
The trick--you may remember--is that frames can't actually take isotopes as arguments. So had there been an actual literal ~end~ there it would be an error condition...it would have to be a ^META parameter, in which case it would show up in the argument as a quoted ~end~ BAD-WORD!.
In any case, what my primitive test does is just look to see if there's an ~end~ isotope in a plain parameter slot, and fills the first one it sees with the switch value.
It's Probably Too Sketchy to Use This Way...
Looking at it realistically, I think it's probably bad to be making such assumptions. It's probably better to have some sort of explicit marker, like a BLANK! or otherwise to show your intent:
switch/all (...some-long-expression...) [
match integer! _ => [print "It's an integer!"]
"bobcat" <> _ => [print "It's not a bobcat"]
<something> => [print "Basic matches would still work"]
]
It seems especially important if there's a fallthrough to plain equality matching.
But still--the FRAME! tricks are pretty good. And I want to keep going after these demos...trying to clean up the rough edges until they really read right.
This example gave me some insights into UPARSE. I decided that the new ANY [...] is just too clear and good to need an @ on the block (like ANY @[...]), just to try and warn you that the block wasn't going to be interpreted in the normal ways by the BLOCK! combinator. That's Rebol's m.o....you're always in new contexts and the rules change. It's comprehensible, so no reason to make it look bad!