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 WAA03229; Fri, 27 Aug 2004 22:56:51 +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 WAA12403 for ; Fri, 27 Aug 2004 22:56:49 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i7RKull4024392 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Fri, 27 Aug 2004 22:56:49 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id E8150B1BB1; Fri, 27 Aug 2004 15:56:46 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id B9568B1BB2; Fri, 27 Aug 2004 15:56:46 -0500 (CDT) Received: from chatterbox.elmer.internal.excelhustler.com ([192.168.0.12]) by localhost (chatterbox [192.168.0.12]) (amavisd-new, port 10025) with ESMTP id 22146-07; Fri, 27 Aug 2004 15:56:44 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id B6894B1BB1; Fri, 27 Aug 2004 15:56:44 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id B4BCD38080; Fri, 27 Aug 2004 15:56:44 -0500 (CDT) From: John Goerzen To: caml-list@inria.fr, skaller@users.sourceforge.net Subject: Re: [Caml-list] Alternative Bytecodes for OCaml Date: Fri, 27 Aug 2004 15:56:43 -0500 User-Agent: KMail/1.7 Cc: Nicolas Cannasse References: <200408250926.28629.jgoerzen@complete.org> <200408271349.25317.jgoerzen@complete.org> <1093639193.15255.1543.camel@pelican.wigram> In-Reply-To: <1093639193.15255.1543.camel@pelican.wigram> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200408271556.44476.jgoerzen@complete.org> X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at excelhustler.com X-Miltered: at nez-perce with ID 412FA00F.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 bytecodes:01 2004:99 2004:99 higher-level:01 syscalls:01 pointers:01 python:01 apis:01 apis:01 python:01 ocaml:01 ocaml:01 garbage:01 approaches:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Friday 27 August 2004 03:39 pm, skaller wrote: > On Sat, 2004-08-28 at 04:49, John Goerzen wrote: > > On Friday 27 August 2004 01:37 pm, skaller wrote: > > > The way to get a library of important utilities > > > for Ocaml is to (a) make interfaces to C and (b) write the code > > > in Ocaml. > > > > Why is C so much better? It's actually pretty darn difficult to > > interface to C from a higher-level language. > > Two reasons. One: C is the portable interface > to almost all operating systems -- there are This means that you could write an OCaml interface to syscalls. Granted, that's an advantage, but one I rarely need. > Two: there are a lot of libraries written > in C with C interfaces, which are either > compliant with some standard or open source. That's true. At the same time, binding to C is just about the most difficult language I could imagine to bind to. There are all sorts of issues to consider. Pointers cause trouble all over the place -- is this bit of data allocated, returned from a static place in a function, a global variable that never should be freed? Is this variable input, output, or both? When do I allow the memory to be freed? What if the C side is using garbage collection too? How do I represent this union in OCaml? Now, I've written plenty of C code. It's tough enough to use several libraries in a pure-C project, let alone with other languages. > In particular most programming languages, > such as Python, have C level APIs. True, though most are also getting .NET CLI-level APIs these days. > So binding to C does really have a particular importance. > Ocaml already has reasonable facilities to do it > (including documentation) I'm not disputing that at all. Obviously this is true. I'm just suggesting that other approaches have utility, too, because they're superior in some situations. > > And (b) is sometimes just NOT an option, either because of time > > constraints or because you don't know what the original code does > > to start with. > > I agree. But an off-the-shelf guarranteed interface to > Java isn't currently available either. Where should you > put your energy? > > > That's way too easy: JDBC. (Not because OcamlDBI sucks but because > > so many databases have JDBC available.) > > Surely enhancing OcamlDBI is a viable option? I have to talk to several databases who provide drivers only for Windows ODBC and Java JDBC. There is no hope of OCamlDBI supporting them, ever. -- John Goerzen Author, Foundations of Python Network Programming http://www.complete.org/pynet ------------------- 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