ALL [...] vs. CASE/ALL

(Note: This is from an old post 4 years ago that was bundled with complaints about PARSE's ANY. The ANY issue turned into its own whole universe of study...however, this question got brushed aside. I'm making it it's own thread, now.)

ALL is a short-circuit construct. The first time it sees a falsey thing, it stops.

>> all [(probe 1) (probe 2 false) (probe 3)]
1
2
; null

But CASE/ALL is explicitly not short-circuit. It takes away CASE's short-circuiting...where the /ALL makes it evaluate every condition. So it will potentially run branches even after it has seen falsey conditions:

>> case/all [true [probe 1] false [probe 2] true [probe 3]]
1
3
== 3

Ren-C chose to make CASE/ALL return the evaluation of the branch associated with the last truthy condition. (Rebol2 and Red just return false if the last condition was falsey.) That aside, both of them evaluate "all of the cases".

This also applies to SWITCH, which has an /ALL refinement as well.

Could we have a word for something that wasn't short-circuit, yet evaluated "all" of the conditions...and just returned the last truthy one or NULL?

CASE/MULTI ? CASE/MANY ?

I just think that using CASE/ALL is misleading when put up against ALL, which is another native control structure...defined in the same file. Having ALL mean something entirely opposite irks me.

1 Like

MULTI sounds pretty good.

CASE/VALID ?
7654321