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 MAA21534; Tue, 18 May 2004 12:36:39 +0200 (MET DST) 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 MAA21603 for ; Tue, 18 May 2004 12:36:37 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4IAaYEV023218 for ; Tue, 18 May 2004 12:36:36 +0200 Received: from [192.168.1.200] (ppp119-251.lns2.syd3.internode.on.net [150.101.119.251] (may be forged)) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i4IAa9Zq073048; Tue, 18 May 2004 20:06:11 +0930 (CST) Subject: Re: [Caml-list] Automatic wrapper generator From: skaller Reply-To: skaller@users.sourceforge.net To: Olivier Andrieu Cc: caml-list In-Reply-To: <20040518.112506.73847465.andrieu@ijm.jussieu.fr> References: <1084869517.19838.409.camel@pelican.wigram> <20040518.112506.73847465.andrieu@ijm.jussieu.fr> Content-Type: text/plain Message-Id: <1084876569.19838.457.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 18 May 2004 20:36:09 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40A9E732.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 andrieu:01 annotations:01 foo:01 int':01 isomorphic:01 low-level:01 annotations:01 abstraction:01 9660:01 glebe:01 unsafe:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 2004-05-18 at 19:25, Olivier Andrieu wrote: > > > Here's your chance to get THE LOT in one go. > > I really don't buy this. There is just not enough information in the C > prototypes to give you a reasonable interface for OCaml. You're right. It doesn't generate an interface any more 'reasonable' than the C one it is wrapping. > Or does your > generator use annotations (like camlIDL does) ? Not at present, although that will be necessary. > For instance, consider this prototype: > int foo (double *, int); > Even if (double *, int) represents an array and its length, the caml > interface is not obvious : > float array -> int -> ... (straightforward mapping) > float array -> ... (use the array length for the int parameter) > float array -> pos:int -> len:int -> ... (account for pointer arithmetic) Yup. So what you actually get 'initially' is: c_double c_ptr -> c_int -> c_int Not a single Ocaml native data type is visible. [Well, we could typemap c_int to 'native_int' since they're isomorphic by specification, and c_double to float for the same reason ..] >In the end you get at best a very low-level bunch of autogenerated > unsafe externals, that you have to re-wrap in ocaml to get something > comfortable and/or safe to program with. That is correct, that's what you get. (1) It's better than nothing :) (2) It can be used to build a better interface *in Ocaml* (3) Once it works, it may be possible to add some annotations to improve the level of abstraction of the generated interface -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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