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 found at http://www.adaic.org/resources/add_content/standards/12rm/html/RM-4-5-7.html (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.) Björn Persson
Attachment:
pgpfin2L3thFb.pgp
Description: OpenPGP digital signatur
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct