caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: miles@caddr.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] hash_variant anomalies
Date: Wed, 04 Jul 2001 09:19:44 +0900	[thread overview]
Message-ID: <20010704091944F.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <20010703081540.A58338@caddr.com>

> I guess the upshot of all this is that it's much easier to map
> polymorphic variants to C constants because there's no easy way to
> calculate the integer value of a normal variant without knowing it's
> position in the variant declaration.  The integer value of a
> polymorphic variant can be computed directly from its name alone.

Hard to say which is hardest: in both cases you must be careful to
synchronize your sources, and avoid typos. Polymorphic variants are
a bit stronger to ansynchronies, since they are by name.

> Overall I have to say writing ocaml-c interfaces is pretty easy.
> Mapping long lists of c enums and defines to ocaml variants seems to
> be one of the more tedious tasks.

Doesn't ocamlidl provide some help with standard variants?
For polymorphic variants, there is a tool called varcc in the lablgtk
distribution. There is no documentation, but examples and source code
should be informative enough. It generates efficient conversion tables
and macros between polymorphic variants and C enums.

Cheers,

Jacques Garrigue
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-07-04  0:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-03  1:02 Miles Egan
2001-07-03  2:18 ` Chris Quinn
2001-07-03  7:42 ` Xavier Leroy
2001-07-03 15:15   ` Miles Egan
2001-07-04  0:19     ` Jacques Garrigue [this message]
2001-07-05  5:58       ` Miles Egan

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=20010704091944F.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=miles@caddr.com \
    /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).