Guards
Suminda Sirinath Salpitikorala Dharmasena
sirinath1978m at gmail.com
Sun Mar 7 02:24:47 UTC 2021
Many be use of & and && for this purpose may be confusing.
Perhaps something like this would be better:
case pattern, pattern, pattern {if(predicate)}, pattern
{if(predicate)}, {if(predicate)}, {if(predicate)}, pattern, pattern
We can still have both
case Point(int x {if (x > 0)}, int y {if (y > x)}):
and
case Point(int x, int y) {if (x > 0 && y > x)}:
or simply:
case Point(int x {if (x > 0)}, int y {y > x}):
and
case Point(int x, int y) {x > 0 && y > x}:
Use of {} would make it easy to see that this is a predicate.
More information about the amber-spec-observers
mailing list