On Fri, Mar 16, 2018 at 12:12:56PM +0100, Bahman Movaqar wrote:
To limit the values possible for a card's actual value, I defined `Value`
module (line 6) which basically maps a variant to integer values.
Is this the idiomatic approach? Is there something like Java's enum or
Pascal's subranges that I could use[1]?
Sicne I didn't notice anyone else answering this, yes the reason and way you wrote Value looks normal. There are preprocessors that can automate repetitive mappings, but I don't think they are an option to consider lightly.
The rest of the code looked normal too, but I'm not familiar with the domain to help more.
--
SP
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs