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 LAA03797; Sat, 28 Aug 2004 11:35:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA03723 for ; Sat, 28 Aug 2004 11:35:50 +0200 (MET DST) Received: from qrnik.knm.org.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i7S9ZlKm000374 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 28 Aug 2004 11:35:50 +0200 Received: from qrnik ([192.168.0.1] ident=qrczak) by qrnik.knm.org.pl with esmtp (Exim 3.36 #1) id 1C0zcg-00082W-00 for caml-list@inria.fr; Sat, 28 Aug 2004 11:35:46 +0200 Subject: Re: [Caml-list] Alternative Bytecodes for OCaml From: "Marcin 'Qrczak' Kowalczyk" To: caml-list In-Reply-To: <1093652716.15255.1636.camel@pelican.wigram> References: <200408250926.28629.jgoerzen@complete.org> <200408271349.25317.jgoerzen@complete.org> <1093639193.15255.1543.camel@pelican.wigram> <200408271556.44476.jgoerzen@complete.org> <1093652716.15255.1636.camel@pelican.wigram> Content-Type: text/plain; charset=ISO-8859-2 Date: Sat, 28 Aug 2004 11:35:45 +0200 Message-Id: <1093685746.16212.21.camel@qrnik> Mime-Version: 1.0 X-Mailer: Evolution 1.5.9.2 Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 413051F3.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 marcin:01 'qrczak':01 kowalczyk:01 qrczak:01 interfacing:01 glue:01 dynamically:01 dynamically:01 reflection:01 glue:01 generic:01 doable:01 threads:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk W li=B6cie z sob, 28-08-2004, godz. 10:25 +1000, skaller napisa=B3: > > That's true. At the same time, binding to C is just about the most=20 > > difficult language I could imagine to bind to. =20 >=20 > Yeah? Just try interfacing two diffent memory management > systems -- eg Ocaml and JVM garbage collectors :) This is easy, as long as you don't mind not collecting cross-language object cycles. Of course you do such thing via C glue. After the basic infrastructure of wrapping and unwrapping objects works, you don't have to think about memory management of data processed by each function separately. It's much easier to use a foreign library written in such language than one written in C, because memory management of a C library is informally described in documentation only. In general, if both languages are dynamically typed, or if the library caller is dynamically typed and the library provider supports reflection, then you might not need any glue specific to a library. A generic wrapper might be convenient enough. Exceptions are also doable, in such a way that they are wrapped and unwrapped automatically. I haven't tried threads. I haven't tried Scheme continuations. It's not clear how they should look like in the other language. Tail call optimization across languages is out of reach even if both languages support efficient tail calls, because converting the result (or just wrapping or unwrapping) prevents any cross-language calls from being tail calls. I don't know if or when it's doable to tie garbage collectors such that cross-language cycles are collected too. What hooks should they provide, assuming both are mark & sweep or copying? > And I'm not disputing that -- in general. I'm just questioning > the utility of accessing inferior technology just > to interface inferior libraries. The libraries are not inferior even if they are written in an inferior language. --=20 __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ ------------------- 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