-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different problems with @enum #15728
Comments
It'll be nice to not define the show methods on the concrete type directly since otherwise it cannot be easily redefined. |
It might be preferable to have an |
Any update on this? |
The fact that you cant use the Julia enum to map into C enum is quite annoying when you want to generate a wrapper. |
Which of the above points still hold? For C enums with multiple fields with the same value, I currently get by with just @enum Fruit apple=1 orange=2
const kiwi = orange |
I found a few problems with the current enum implementation:
OutOfMemory
exceptions.@enum
can't be use with Clang to wrap c.enum1 & enum2 == enumx
, this functionality might be wanted in Base as wellenum_values
&enum_names
, which return the sorted list of enums (i initially thought the number of emitted functions are the reason that compilation is so slow)Last point got a bit less interesting after fixing the other points made everything compile fast already.
I still wrote a toy implementation of it:
https://gist.github.com/SimonDanisch/88f73018d6bf5219574ec1c679bc76ef
What we should at least use from this is:
For the unique values, we should decide if there should be an extra type Cenum, or if we just don't guarantee mappings to correct names if you decide to use multiple fields with the same value.
Best,
Simon
The text was updated successfully, but these errors were encountered: