Many thanks,
On Fri, 14 Mar 2008 15:29:41 -0700
Karl Zilles < zilles%401969web.com">zilles
1969web.com> wrote:
> How about integer constants:
>
> let color_box = 1
> and color_background = 2
> and color_menu = 3;;
>
> assert (init_pair color_box Color.red Color.white);
> assert (init_pair color_background Color.blue Color.yellow) ...
> assert (init_pair color_menu Color.green Color.cyan) ...
>
> A.color_pair color_background
Maybe with this ( GUI ? )example, there are few chances to get some :
A.color_pair 944
because the colour_pair arguments is probably immediately explicited by one of the 3 constants, not the result of a computation.
However I would be happy to give the compiler the possibility to perform its static type checking.
> (keep the names abstract rather than red_on_white, so you can change
> colors easily)
I see, but this would remain possible with an extra definition around :
let color_box = red_on_white
Before to see the perfect solution, I'll nevertheless program things the way you've explained.
Regards,
Fabrice
.