Crell / enum-comparison

A comparison of enumerations and similar features in different languages
82 stars 7 forks source link

Empty enum #29

Closed iluuu1994 closed 3 years ago

iluuu1994 commented 3 years ago

The RFC currently says:

An Enumeration may have one or more case definitions, with no maximum, although at least one is required.

Any reason for requiring at least one case? All other language constructs allow empty bodies.

Crell commented 3 years ago

What use would an empty enum have? I can't think of one. A single-element Enum would be a category theory "unit" (a type with only one value, and thus adds no value to a product type), but I don't know what purpose a 0-element Enum has.

iluuu1994 commented 3 years ago

Nothing really. What's an empty if statement useful for? Nothing really. We allow it anyway :)

Crell commented 3 years ago

I don't feel strongly enough about it either way, so whatever gets it the most votes works for me.

iluuu1994 commented 3 years ago

I think it would be more consistent. We allow empty classes, functions, if statements, switch statements, match expressions, etc.

Crell commented 3 years ago

Changed the RFC.

iluuu1994 commented 3 years ago

Thanks!