caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bluestorm <bluestorm.dylc@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Symbol type
Date: Mon, 28 Jun 2010 06:56:08 +0200	[thread overview]
Message-ID: <AANLkTin6kRFjYhiTG5pk2s_WaNlfwbko3sWPHs_9mncC@mail.gmail.com> (raw)
In-Reply-To: <20100628021543.GA14360@malaquias.DHCP-GERAL>

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

If your set of symbol is closed, you can use a variant type (sum type).

type symbols =
| A
| B


If you really need open symbols, you can use [polymorphic variants].

Let tag_a foo = (`A, foo)

 [polymorphic variants]
http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#toc36


However, you won't have convenience functions such as string_of_symbol; you
would have to define them yourself.

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

      parent reply	other threads:[~2010-06-28  4:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28  2:15 José Romildo Malaquias
2010-06-28  2:33 ` Michael Ekstrand
2010-06-28 13:37   ` [Caml-list] " Nicholas Kidd
2010-06-28  4:56 ` bluestorm [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=AANLkTin6kRFjYhiTG5pk2s_WaNlfwbko3sWPHs_9mncC@mail.gmail.com \
    --to=bluestorm.dylc@gmail.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;
as well as URLs for NNTP newsgroup(s).