blob: 2a144c6899568d3e1ed23d2b303f2503bc0abcc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
Clever way to combine parenthesis-less functions and boolean expressions.
This isn't new, it's already done by POSIX shell script :)
if ! check_stuff 123 "stuff" && is_ok 45 67; then
...
fi
This could be done in SLUL too, but with keywords instead of
expressions:
if not check_stuff 123 "stuff" and is_ok 45 67
...
end
Or, using `where`:
where c = check_stuff 123 "stuff"
where o = is_ok 45 67
if all_of c o
...
end
# related: when should `where` be evaluated?
# - in the exact place it appears? (can be inefficient)
# - at each "instantiation" (can be inefficient)
# - lazilly, on first usage?
# (but perhaps with a requirement that the order cannot
# affect behavior)
Or, using `if_all`/`if_any`/`if_none`:
if_all
check_stuff 123 "stuff"
is_ok 45 67
then
...
end
# this is a form of a multi-block statement, with a expr-list-block
# first and then a statement-block
Perhaps `all`, `any`, `none` should be keywords on their own,
so it can work with `while' loops?
(but it could be confusing/impossible with assignment to boolean variables)
(also, it needs to be able to "stop" at either `then`, `do`, ...)
if all
check_stuff 123 "stuff"
is_ok 45 67
then
...
end
while all
check_stuff 123 "stuff"
is_ok 45 67
do
...
end
do
...
while # <--- ambuigity!!! :(
check_stuff 123 "stuff"
is_ok 45 67
end
|