From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA09090; Sun, 3 Mar 2002 22:16:48 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA04797 for ; Sun, 3 Mar 2002 22:16:47 +0100 (MET) Received: from mel-rto7.wanadoo.fr (smtp-out-7.wanadoo.fr [193.252.19.26]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g23LGib04980 for ; Sun, 3 Mar 2002 22:16:45 +0100 (MET) Received: from mel-rta3.wanadoo.fr (193.252.19.153) by mel-rto7.wanadoo.fr; 3 Mar 2002 22:16:42 +0100 Received: from debian (80.8.74.59) by mel-rta3.wanadoo.fr; 3 Mar 2002 22:15:57 +0100 Received: from moi by debian with local (Exim 3.34 #1 (Debian)) id 16hdJq-0000ez-00 for ; Sun, 03 Mar 2002 22:14:58 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] External typing References: <000001c1c2ef$06d74cb0$7000a8c0@warp> From: Remi VANICAT Date: 03 Mar 2002 22:14:58 +0100 In-Reply-To: <000001c1c2ef$06d74cb0$7000a8c0@warp> Message-ID: <87lmd95p65.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "Warp" writes: > Hi > I have something like : > > external f1 : my_very_long_indentifier -> one_other_id -> int = "f1" > external f2 : my_very_long_indentifier -> one_other_id -> bool = "f2" > .... > > And I would like to have : > > type 'a conv = my_very_long_indentifier -> one_other_id -> 'a > > external f1 : int conv = "f1" > external f2 : bool conv = "f2" > > Which is - you'll agree - a lot nicer. > > But the computer yield to me "External identifiers must be > functions" when I try this. Is that notation really impossible with > externals or is there some tip ? Does the compiler shouldn't know > that "int conv" is a functional type ? >>From the ocaml documentation, you can read that "The arity (number of arguments) of a primitive is automatically determined from its Caml type in the external declaration, by counting the number of function arrows in the type." So for example if you want a c function taking 1 int and returning a function from int to int : type int2int = int -> int external f2 : int -> int2int = "f2" so you can't do what you want with ocaml, the only solution is to use camlp4 -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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