English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
[Caml-list] currying...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-03-07 (00:21)
From: qrczak@k...
Subject: Re: [Caml-list] currying...
Tue, 06 Mar 2001 15:23:50 -0800, Chris Hecker <checker@d6.com> pisze:

> - the library needs to know whether this is "int (*)(int,int,int)"
> or "int (*(*)(int))(int)" (or something else)

So you have to tell it (by some other mean than OCaml's type alone).
It has nothing to do with physical arity of OCaml's function closures.
It describes a C type.

> so that it can create a closure to pass back to caml that has the
> right physical arity

No, it needs not to create an OCaml closure of any particular arity.
It must create a closure which behaves in a particular way: calls the
C function after it received the necessary number of arguments. It
doesn't matter what is the arity from OCaml's internals' point of view.

You can't in general let the original C function pointer mimic OCaml's
code pointer in a closure anyway. First of all, types of values will
be different: C has a wide variety of types, OCamls wraps everything
as either a pointer or a tagged integer.

> Since this is all happening dynamically, I need to be able to deduce
> the physical arity of the functions at runtime.

Deduce from what? I understood that you create an OCamls function,
not examine it!

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZASTĘPCZA

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