Christoffer Lerno

Results 1219 comments of Christoffer Lerno

What should is_keyer do?

Added as @is_cmp_key_fn in `dev`

Auto-incrementation could happen, although I don't see all that much use for it to be honest. When you're using values that's usually what you want for everything, barring the case...

I think it's mostly automating debug things.

I tentatively tried implementing this, but as far as I can tell, the benefit seems small over enums with associated values: ```c constset Foo : int { ABC = 3,...

The advantage is somewhat greater when going the other direction: ```c // With constset extern fn Foo c_foo(); ... switch (c_foo()) { case Foo.ABC: ... case Foo.BCE: ... ... }...

We could imagine supercharging associated values, in which case we'd get this: ```c enum Bar : int(inline int val) { ABC(3), BCE(123) } extern fn void some_c_bar(int val); ... some_c_bar(Bar.ABC);...

But we could go further with this, although at a greater cost to the grammar: ```c // Imagine the associated type can be used as a pseudo-type: extern fn void...

It's fairly straightforward to construct a macro `@enum_by_value` that would do something like: ```c extern fn int _c_bar() @extern("c_bar") @local; macro Bar c_bar() => @enum_by_value(Bar, val, c_bar()); ``` Which then...