The advent of the CHAIN! datatype has provoked the idea of dialecting function calls themselves.
I've given examples like pointing the variable to blame for a failure...because you often don't really want an error message to implicate the location where the error itself is raised, but rather some callsite arbitrarily far up the stack.
The proposal I had for this was to change:
fail:blame ["This failure will implicate VAR at callsite"] $var
Into:
fail:$var ["This failure will implicate VAR at callsite"]
Another idea I mentioned was the concept of folding the function you want to use as a predicate into the chain. At first I suggested allowing these names to conflate with what looked like a refinement:
>> any:even? [1 3 8 7 10]
== 8
The rationalizing I used was to say "Well, in dialects we have cases where if a keyword isn't recognized then it falls back to looking up the word." That's how PARSE works... like in this historical case:
red>> begin: "[" end: "]"
== "]"
red>> parse "[aaa]" [begin copy stuff to end skip]
== false
Er, so maybe I should say "that's how PARSE doesn't work". In any case, the END keyword overrode the END variable definition. But BEGIN matched, because there's no parse keyword for BEGIN.
(Note: This is a reason why Ren-C uses <end>
the tag combinator instead of END the word combinator...and other tag combinators for noun-like things.)
So maybe it's not the best plan to follow the lead there. Another idea would be to use a TYPE-WORD!
>> any:&even? [1 3 8 7 10]
== 8
It's a little clunkier, but it's clearer what's going on. In this case, the predicate is a single arity function which returns NULL or OKAY...and that's what ANY wants, so it's a particularly good match.
That also works for my suggestion of quote:&word?
and meta:&raised?
. Though it implies that if you composed them together you'd have to say quote:"e:&word?
, and it doesn't look as good as quote:quote:word?
Also...in this case the predicate is a single arity function that returns a logic. But other cases aren't, and wouldn't make sense to use &
. What about them?
Is Conflation Stupid, Or Outside-The-Box Genius?
I can't really tell if allowing you to write the likes of any:even?
and proceeding blissfully along outweighs the missing "conscious marker" of why EVEN? wouldn't be any refinement you can find on the HELP for ANY.
Part of me thinks "that's the way this game is played". Another part of me is thinking about how the system wouldn't know what to do with this. How would the system know how to specialize that, and put EVEN? into the :PREDICATE slot? Would any:even?/
just throw up its hands and error? For that matter, does any:&even?/
really get any easier?
I guess that aspect of "it doesn't get any easier either way" suggests we have room to experiment and see how it feels.
Actions would have to have some kind of "Interpret Chain" hook that would go from CHAIN! => FRAME!. Because this is likely to be performance sensitive, the system should offer some kind of parameterization of the default hook (e.g. "if you don't recognize anything from the spec, fetch it and throw it into parameter named XXX" or "if you see something with a certain sigil, fetch it and throw it into a parameter named YYY")
I guess I'd like to try living in the any:even?
and meta:raised?
universe a bit and get a bit more informed before making the stupid vs. genius verdict.