Naming of bitwise OR, AND, XOR

All right, I think we have the actual, final answer (at least for the conditional operators, not the bitwise ones. :-/)

The answer comes from the notion that "Plain GROUP! branches only run if branch taken"

Basically, we have precedent now that:

>> branchy: func [flag] [either flag '[<a>] '[<b>]]

>> either true (print "a" branchy true) (print "b" branchy false)
a
== <a>

Most people seem to think this makes perfect sense...and if you want the less-intuitive behavior of running both branches you can get it with GET-GROUP!.

If you think that makes perfect sense, why be surprised at this:

>> false and (print "right" false)
== #[false]

>> true and (print "right" true)
right
== #[true]

Not exactly universe-shattering to absorb that consequence. Then, if you want the right hand side to run unconditionally, you use a GET-GROUP!:

>> false and :(print "right" false)
right
== #[false]

That looks pretty sensible to me. It just means that the right hand side of an AND has to be in a GROUP! or a GET-GROUP!, which you'd probably want a lot of the time anyway.

2 Likes