On Sunday, 17 April 2022 at 18:25:32 UTC, Bastiaan Veelo wrote:
The reason is in [17.1.5](https://dlang.org/spec/enum.html):
“EnumBaseType types cannot be implicitly cast to an enum type.”
Thy. That's the anchor in the specs preventing Enums to be
integral types.
On Tuesday, 19 April 2022 at 13:20:21 UTC, Bastiaan Veelo wrote:
There is nothing that requires enum values to be unique, though:
```d
import std;
void main()
{
enum E {Zero = 0, One = 0, Two = 0}
writeln(E.Two); // Zero!
}
```
True, but if you want it be useful they really need to be
On Tuesday, 19 April 2022 at 01:25:13 UTC, Era Scarecrow wrote:
The 'integral' or numeric value is used for uniqueness, […]
There is nothing that requires enum values to be unique, though:
```d
import std;
void main()
{
enum E {Zero = 0, One = 0, Two = 0}
writeln(E.Two); // Zero!
}
```
On Sunday, 17 April 2022 at 18:25:32 UTC, Bastiaan Veelo wrote:
On Saturday, 16 April 2022 at 11:39:01 UTC, Manfred Nowak wrote:
In the specs(17) about enums the word "integral" has no match.
But because the default basetype is `int`, which is an
integral type, enums might be integral types
On Saturday, 16 April 2022 at 11:39:01 UTC, Manfred Nowak wrote:
In the specs(17) about enums the word "integral" has no match.
But because the default basetype is `int`, which is an integral
type, enums might be integral types whenever their basetype is
an integral type.
On the other hand
In the specs(17) about enums the word "integral" has no match.
But because the default basetype is `int`, which is an integral
type, enums might be integral types whenever their basetype is an
integral type.
On the other hand the specs(7.6.5.3) about types say
| A bool value can be implicitly