This is quite counter-intuitive, and as a pattern is not extensible to allow for things like EITHER. It would line up better with the expectations of users and the behaviors of the language in general if it were arity-2, as most would expect...and if it failed, it simply did not contribute the corresponding rule.
>> parse "ac" ["a" if (false) ["b"] "c"]
true
>> parse "abc" ["a" if (true) ["b"] "c"]
true
If coupled with an EITHER construct, then this could use a single condition to trigger failure or not, e.g.
>> parse "abc" ["a" either (condition) ["b"] [reject] "c"]
Submitted by: Hostilefork
The current implementation of IF considers it to be a standalone, arity-1 operation, which either allows you to keep processing or fail:
This is quite counter-intuitive, and as a pattern is not extensible to allow for things like EITHER. It would line up better with the expectations of users and the behaviors of the language in general if it were arity-2, as most would expect...and if it failed, it simply did not contribute the corresponding rule.
If coupled with an EITHER construct, then this could use a single condition to trigger failure or not, e.g.
Imported from: https://github.com/rebol/rebol-issues/issues/2271
Comments:
Note this Red user faced the exact same confusion: https://gitter.im/red/red/welcome?at=59080fc808c00c092ad567aa
I like the arity-2 version a lot better.