caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lauri Alanko <la@iki.fi>
To: caml-list@inria.fr
Subject: [Caml-list] CamlIDL and true abstract types
Date: Fri, 17 May 2002 22:45:37 +0300	[thread overview]
Message-ID: <20020517224534.A697@kruuna.Helsinki.FI> (raw)

Hello. I recently learned of CamlIDL (thanks to the list), and tried it out.
After trying it out for a while, it seems to me that an absolutely essential
feature is missing: abstract types.

With an abstract type I mean a type whose representation is known neither at
the C side nor in the caml world. Typically these are of the form:

typedef struct Foo_ Foo;

Where the actual definition of struct Foo_ is completely missing from public
headers, or even if it is not, its structure is supposed to be an
implementation detail. These sorts of types are needed often enough in many
bindings, and the Caml translation for Foo* should be clear:

type foo

Yet somehow there seems to be no direct way for doing this within CamlIDL.
How come?

Another funny thing about CamlIDL is that it translates everything _by
value_. C structs are transformed to newly allocated caml blocks and vice
versa. Yet often enough the _identity_ of the struct (ie. its physical
address) is essential. And though CamlIDL provides the "ptr" translation for
pointers, it uses Com.unique as the translation type instead of a pure
abstract type. And it provides no way to directly access or modify fields of
existing C structs.

To my mind, this makes CamlIDL unusable for creating bindings for anything
but the most simple-minded libraries. Yet many people seem to promote it.
Have I misunderstood something?


Lauri Alanko
la@iki.fi
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2002-05-17 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-17 19:45 Lauri Alanko [this message]
2002-05-18  7:03 ` Dmitry Bely
2002-05-18 23:42   ` Lauri Alanko
2002-05-24 16:02     ` Dmitry Bely

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=20020517224534.A697@kruuna.Helsinki.FI \
    --to=la@iki.fi \
    --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).