From: SP <sp@orbitalfox.eu>
To: Bahman Movaqar <bahman@bahmanm.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] On variants, integers and testing
Date: Mon, 19 Mar 2018 21:24:49 +0000 [thread overview]
Message-ID: <20180319212449.htqtzkkw55oj7fsf@darkstar> (raw)
In-Reply-To: <CACOw_MrR5M66=CB8Z=f7B+xiv5r8U87P3kE=p_8kyu8OCKCrjw@mail.gmail.com>
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
next prev parent reply other threads:[~2018-03-19 21:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 11:12 Bahman Movaqar
2018-03-19 10:41 ` Cedric Cellier
2018-03-19 10:44 ` Cedric Cellier
2018-03-19 13:27 ` Yawar Amin
2018-03-19 13:49 ` Yawar Amin
2018-03-19 21:24 ` SP [this message]
2018-03-21 14:36 ` Lukasz Stafiniak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180319212449.htqtzkkw55oj7fsf@darkstar \
--to=sp@orbitalfox.eu \
--cc=bahman@bahmanm.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox