There are libraries, like OpenGL, with very rich collections of enums. In 
bindings to these libraries, the enums are used directly as integers, with 
no special meaning attached to them, and the integers are passed directly 
to the C functions.

If you compare this with Haskell, for example, 
(https://hackage.haskell.org/package/OpenGL-2.11.0.0/docs/Graphics-Rendering-OpenGL-GL-BufferObjects.html),
 
there enums are transformed to Haskell type constructors, so it's no longer 
possible to pass a wrong "kind" of enum to a C function.

What's a good Julian way of specifying richer relationships between plain C 
enums and their meaning?

If symbols are the way to go, how would you write down a function that 
takes a symbol as an argument, but only accepts a specific list of symbols? 
Would you just use a Dict{Symbol, Cenum} to express the mapping between 
Julia symbols and C enums?

Do you think it's a good idea to replace C enums with "richer" Julia 
values, when most users are probably just fine working with plain integers?

This is an issue for most Julia bindings to C libraries, but it is probably 
not very important because using plain enums doesn't lead to that much 
trouble for anyone familiar with the underlying C library.

Reply via email to