Open wongjiahau opened 5 years ago
This proposal is a breaking change.
The previous if keyword needs to be changed to case, and else need to be changed to default.
if
case
else
default
Consider we wants to create the following function:
(this Int).compare(that Int) = this.==(that). case(true): (0) case(false): (this.>(that). case(true): (1) case(false): (1.negate))
That is tedious, so we should do like this instead:
(this Int).compare(that Int) = this. if(.==(that)): (0) if(.>(that)): (1) else: (1.negate)
Is much more cleaner, however, needs more revision on this.
This proposal is a breaking change.
The previous
if
keyword needs to be changed tocase
, andelse
need to be changed todefault
.Why?
Consider we wants to create the following function:
That is tedious, so we should do like this instead:
Is much more cleaner, however, needs more revision on this.