caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Sébastien Hinderer" <Sebastien.Hinderer@ens-lyon.org>
To: david.baelde@ens-lyon.org
Cc: caml-list@yquem.inria.fr
Subject: Re: Creating wrappers for C libraries
Date: Fri, 8 Dec 2006 12:08:54 +0100	[thread overview]
Message-ID: <20061208110854.GA9375@galois> (raw)
In-Reply-To: <53c655920612080218t765e9614j5d16c3b397f6691c@mail.gmail.com>

Hi.

> One problem with such automated tools is that they have no clue of
> which C function takes time and which returns almost instantly.

Thanks a lot for this remark.

I'm also wondering how good automatic tools are for taking advantage of
Caml's rich typing system and of Caml features like exceptions.
An example will probably make my question more clear.
How would an automatic tool bind the open(2) function that returns either a
file descriptor (on success), or -1 to report failures, the precise reason
for the failure being contained in the errno variable. Would it be possible
to specify, with an automatic tool, that the returned valid is an int
unless open returns -1, in which case an error should be
reported through an exception ?

Or would an automatic tool bind open to a function returning an int in any
case, the task of testing the returned value having then to be performed
by the programmer, but in Caml ?

Sébastien.


  reply	other threads:[~2006-12-08 11:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08  4:54 Erik de Castro Lopo
2006-12-08  6:36 ` [Caml-list] " Chris King
2006-12-08  6:45 ` Sébastien Hinderer
2006-12-08  7:08 ` [Caml-list] " Jon Harrop
2006-12-08 10:18   ` David Baelde
2006-12-08 11:08     ` Sébastien Hinderer [this message]
2006-12-08 11:41 ` Richard Jones
2006-12-08 12:00   ` Daniel Bünzli

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=20061208110854.GA9375@galois \
    --to=sebastien.hinderer@ens-lyon.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=david.baelde@ens-lyon.org \
    /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).