[HEADS UP] rpm-4.12.90 in rawhide
Bjorn at xn--rombobjrn-67a.se
Thu Jul 30 10:22:48 UTC 2015
Michael Schroeder wrote:
> And there's IF and THEN/ELSE. IF is a postfix op, like in perl
> and ruby:
> Requires: a IF b
There's no ELSE part in this variant?
> THEN/ELSE is the infix one:
> Requires: b THEN a
> Requires: b ? a
> Requires: b THEN a ELSE c
> Requires: b ? a : c
"THEN" without "IF" is confusing. "b THEN a" doesn't look like a
condition at all; it looks like "first b and then a".
Algol 60 had conditional expressions of the form "if C then P else Q".
Algol 68 added "elif" and required that if expressions be terminated
with "fi" so that it's always clear where the expression ends:
"if C then P elif D then Q else R fi".
A similar syntax was chosen when conditional expressions were added to
Ada in Ada 2012. Although if statements are terminated with "end if;"
in Ada, if expressions are not. Instead conditional expressions must
always be enclosed in parentheses to avoid ambiguities. Ada also uses
"elsif" instead of "elif": "(if C then P elsif D then Q else R)"
I would recommend that the Ada 2012 syntax be adopted in RPM. It's easy
to read, unambiguous and expressive. The formal specification can be
(Ada 2012 also has another kind of conditional expressions: case
expressions analogous to case statements. RPM won't need those if the
condition is always boolean.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: OpenPGP digital signatur
More information about the devel