caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@best.com>
To: Luc Maranget <Luc.Maranget@inria.fr>
Cc: John Max Skaller <skaller@ozemail.com.au>, caml-list@inria.fr
Subject: Re: [Caml-list] ocaml and named constants
Date: Thu, 31 May 2001 09:34:09 -0700 (PDT)	[thread overview]
Message-ID: <Pine.BSF.4.21.0105310913340.8508-100000@shell5.ba.best.com> (raw)
In-Reply-To: <200105310922.LAA0000007458@beaune.inria.fr>

On Thu, 31 May 2001, Luc Maranget wrote:
> But I have another remark
> as far a ``manifest constants'' are the issue, Polymorphic
> variants
> (http://caml.inria.fr/ocaml/htmlman/manual003.html)
> seem to do the job.
> 
> After all, provided you do not care much about the actual value of Foo)

Ah, the problem for me is that I really do care about the actual value for 
the constants. It turns out that I may process binary file formats (GDSII
is the canonical example) where I want the name to correspond to a number. 
Of course, I can and do do it by hand (or use P4) by writing the equivalent of 
Ada's 'Pos and 'Val attributes for enumerated types. I would use plain old 
sum types too since I don't need them to be open for extension. It's a bit 
more cumbersome than I'd like it since I have to specify the mapping twice 
(constructor -> integer and integer -> constructor) which is cumbersome.

-- Brian


-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  reply	other threads:[~2001-05-31 16:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-23 17:06 David Fox
2001-05-28 12:32 ` Xavier Leroy
2001-05-29  1:07   ` John Max Skaller
2001-05-29 12:12     ` Andreas Rossberg
2001-05-29 17:16       ` John Max Skaller
     [not found]         ` <skaller@ozemail.com.au>
2001-05-30  9:46           ` Wolfgang Lux
2001-05-29 13:50     ` Luc Maranget
2001-05-30 16:50       ` Brian Rogoff
2001-05-31  9:22         ` Luc Maranget
2001-05-31 16:34           ` Brian Rogoff [this message]
2001-06-01  4:39             ` David Fox
2001-06-01  1:45           ` John Max Skaller

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=Pine.BSF.4.21.0105310913340.8508-100000@shell5.ba.best.com \
    --to=bpr@best.com \
    --cc=Luc.Maranget@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=skaller@ozemail.com.au \
    /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).