So the question of UNTIL being prefix vs. postfix makes me wonder, if UNTIL would be better as postfix.
let x: 0
(
x: x + 1
print ["X is" x]
) until x = 5
or on a new line:
let x: 0
(
x: x + 1
print ["X is" x]
)
until x = 5
Compare to:
let x: 0
insist [
x: x + 1
print ["X is" x]
x = 5
]
The bargain here of weird infix isn't quite the same as with the infix UNLESS, because your left hand side is almost always going to be multiple lines of code, vs. a single value or tiny expression. You have to be doing something that can alter state and have side-effects, to change things enough that the until terminates.
Personally I think CYCLE works better here:
let x: 0
cycle [
x: x + 1
print ["X is" x]
if x = 5 [stop]
]
You can put your STOPs anywhere you want. And you can use STOP:WITH if you want to evaluate to a value.
As an interesting variation... my ATTEMPT looping construct that runs a loop body exactly once, could have RETRY in it:
let x: 0
result: attempt [
x: x + 1
print ["X is" x]
if x != 5 [again] ; this is where I think AGAIN should be used
x * 10 ; you could separate the retry triggers from loop result
]
assert [result = 50]
ATTEMPT would give you BREAK (drop NULL out the bottom), CONTINUE and CONTINUE:WITH (drop VOID or a value out the bottom), and then this additional AGAIN to just take it from the top.
(Perl calls this REDO. I thought maybe RETRY but we have trouble in that TRY and RETRY sound related, and DO and REDO sound related... but... only so many words. Seems the right use for AGAIN.)
So I can't endorse postfix UNTIL
Even though UNLESS has shown cool usages, those just don't add up for a postfix UNTIL.
UNTIL as a synonym for WHILE-NOT is the better idea. And an ATTEMPT construct that's able to run AGAIN from the top is much clearer than INSIST in most cases... but INSIST will still be available.