On Wednesday, 20 April 2016 at 07:23:09 UTC, Bastiaan Veelo wrote:
On Wednesday, 20 April 2016 at 07:18:55 UTC, Bastiaan Veelo wrote:
On Wednesday, 20 April 2016 at 06:36:01 UTC, bearophile wrote:
Dominikus Dittes Scherkl:

final switch makes no sense on things that are not enumerated. Even on ubyte almost nobody will ever list all 256 cases, not to mention larger types.

It's easy to cover all the values in a switch, using ranges.

2. No CaseRangeStatements are allowed.

Sorry, pressed Send too early. You mean implement to remove the above limitation?

Anyway, something need to be changed.
a) allow Range Cases (nice for ints but bad idea for enums)
b) require also non-enum types to explicitly state all cases (bad idea for any multi-byte type, even near useless for single bytes)
c) forbid other types than enum in final switch

I strongly vote for (c).

Reply via email to