Christoffer Lerno
Christoffer Lerno
To add a bit to this, why do I say that it's "complex"? Well, for any variant of this that is anything but a convenient way of creating a distinct...
Unfortunately Foo::ABC and Foo.ABC both require modeling it as a separate type.
@cbuttner Associated values as such has been in the language from the beginning and is very useful for certain use-cases. So the problem here is more whether we can leverage...
> Benefit №1: Is the automatic numbering here of some essential use? I don't see it to be honest ```c enum Foo : int(int val) { A(3), B(4), C(A.val +...
Note here that we could add this: ```c enum Foo : int(int val) { ABC = 1, BCD = 3, } ``` As mere *syntax sugar* for ```c enum Foo...
As I said, keeping both C style enums and the regular ones is going to have a prohibitively high complexity cost, so this would need to be implemented as a...
No they can't that doesn't make sense even. There is no "associated enum" either. There's just enums backed by ordinals and enums that are glorified constants i.e. C enums. The...
```c enum Foo : int { int val } { ABC = { 1 }, BCD = { 3 }, } ``` Is ambiguous, so some alternatives are ```c enum...
Here is a real example of an enum with associated value: ```c enum Dir : char(int[] dir) { NORTH({ 0, -1 }), EAST ({ 1, 0 }), SOUTH({ 0, 1...
The feature is kind of hard to judge the scope of to be honest: regardless of what syntax is used, this is the kind of feature you then could leverage...