Demand: "Better" syntax for demand signatures
@simonpj said that he doesn't quite like the current syntax (since #18903 (closed), see also the updated entry for -fstrictness
in the user's guide on master) of demand signatures, in particular the abbreviations of Card
s and the fact that we now prefix product demands with P
(e.g. SP(SU,A)
).
Card
s
Abbreviation for The current abbreviations for Card
s are
interval | set of denoted cardinalities | ppr syntax | explanation tying syntax to semantics |
---|---|---|---|
[1,0] | {} | B |
bottom |
[0,0] | {0} | A |
absent |
[0,1] | {0,1} | 1 |
used at most once |
[0,n] | {0,1,n} | U |
top, no information, used at least 0 and at most n times |
[1,1] | {1} | S |
strict, used exactly once |
[1,n] | {1,n} | M |
"multi-strict", used at least once, but possibly many times |
Simon argued that
- he always mistakes
1
to mean "exactly once" rather than "at most once" (The only reason I chose 1 here in the first place was that usage demands prior to #18903 (closed) used it that way) - then thinks that
S
is a better fit forM
-
U
should really beL
azy. (similarly, I choseU
because it was the top element in the usage lattice, no particular reason.)
His suggestions leave open how to name "at most once" then. He proposed F
for "few", but I'm not satisfied with that.
So, in summary, we have
interval | set of denoted cardinalities | ppr syntax | explanation tying syntax to semantics |
---|---|---|---|
[1,0] | {} | B |
bottom |
[0,0] | {0} | A |
absent |
[0,1] | {0,1} | M |
used at most once, "Maybe" |
[0,n] | {0,1,n} | L |
top, no information, used at least 0 ("lazy") and at most n times |
[1,1] | {1} | 1 |
used exactly once |
[1,n] | {1,n} | S |
used at least once, but possibly many times |
Product sub-demands
Simon proposed to omit the P
in a demand like SP(SU,A)
--> S(SU,A)
. But if we omit the P
in call sub-demands, in which product sub-demands occur without the leading evaluation cardinality of the surrounding demand, look a bit weird because of the doubly nested parentheses: C1(P(SU,A))
--> C1((SU,A))
. We can't omit them, otherwise C1(SU)
is ambiguous with C1(P(SU))
.
Maybe the doubly nested parentheses are OK.
Summary
We need to settle on a notation for cardinalities, where the "used at most once" slot is contested the most, and also decide whether we want to drop the P
in product sub-demands, which means making peace with doubly nested parentheses C1((SU,A))
.
The discussion ultimately settled for M
("Maybe") and not omitting the P
.