When using external libs (i.e. opengl) there are functions, that take different sets of the same constants as parameters.
Example: function f1 can take a or b as parameter, function f2 can take a and c as parameter.
Something like this using enums won't work:
(def-enum T1 extern int (a b))
(def-enum T2 extern int (a c))
(def f1 (fn extern-c void ((x T1))))
(def f2 (fn extern-c void ((x T2))))
So enums may not be a good choice in such cases. Would it be best in this case to define a general enum for all overlapping constants, and handling the type-checking in macro-versions of the functions, or may something like overlapping enums be implemented into the language?
So the chosen function won't dispatch on the value type, but the chosen value will dispatch on the function parameter type instead.
When using external libs (i.e. opengl) there are functions, that take different sets of the same constants as parameters. Example: function f1 can take a or b as parameter, function f2 can take a and c as parameter. Something like this using enums won't work:
So enums may not be a good choice in such cases. Would it be best in this case to define a general enum for all overlapping constants, and handling the type-checking in macro-versions of the functions, or may something like overlapping enums be implemented into the language? So the chosen function won't dispatch on the value type, but the chosen value will dispatch on the function parameter type instead.