waneck / haxe-genc

20 stars 2 forks source link

representation of C-style enums #18

Closed ousado closed 11 years ago

ousado commented 11 years ago

related issue https://github.com/HaxeFoundation/haxe/issues/923

see e.g. http://icu-project.org/apiref/icu4c/utypes_8h_source.html for a "complicated" case. I'd like to have static exhaustiveness checks for these. I'd suggest

@:cEnum enum Errors { @:value(1) Err1; @:value(2) Err2; ... } (or something like that, I don't really care for the naming much)

until that issue is closed. This is too useful, especially for C, to not do it.

Simn commented 11 years ago

The haxe issue has been closed, we now have @:fakeEnum abstracts (although I still plan to change the metadata name). Can we use this here?

ousado commented 11 years ago

yes, I think so

waneck commented 11 years ago

Guess it's closed then. However it'd be so nice to support the enum X { A = 10; B = 20; } syntax :) . Did Nicolas rule that out?

Simn commented 11 years ago

I wanted something like abstract enum to distinguish it, but discussing syntax with Nicolas is like discussing politics with the sky. ;)