caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lukasz Stafiniak <lukstafi@gmail.com>
To: SP <sp@orbitalfox.eu>
Cc: Bahman Movaqar <bahman@bahmanm.com>, Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] On variants, integers and testing
Date: Wed, 21 Mar 2018 15:36:31 +0100	[thread overview]
Message-ID: <CAJMfKEVaLyYKi8_8xrwywYXArW=t1PiWALz3wgNzBXMZ9xtgWg@mail.gmail.com> (raw)
In-Reply-To: <20180319212449.htqtzkkw55oj7fsf@darkstar>

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

You could also consider private type abbreviations:

https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec236

On Mon, Mar 19, 2018 at 10:24 PM, SP <sp@orbitalfox.eu> wrote:

> 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
>

-- 
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

[-- Attachment #2: Type: text/html, Size: 2092 bytes --]

      reply	other threads:[~2018-03-21 14:37 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
2018-03-21 14:36   ` Lukasz Stafiniak [this message]

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='CAJMfKEVaLyYKi8_8xrwywYXArW=t1PiWALz3wgNzBXMZ9xtgWg@mail.gmail.com' \
    --to=lukstafi@gmail.com \
    --cc=bahman@bahmanm.com \
    --cc=caml-list@inria.fr \
    --cc=sp@orbitalfox.eu \
    /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;
as well as URLs for NNTP newsgroup(s).