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 PAA20747; Tue, 22 Jun 2004 15:34:46 +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 PAA20670 for ; Tue, 22 Jun 2004 15:34:44 +0200 (MET DST) Received: from mail4.speakeasy.net (mail4.speakeasy.net [216.254.0.204]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i5MDYgEV019836 for ; Tue, 22 Jun 2004 15:34:42 +0200 Received: (qmail 27668 invoked from network); 22 Jun 2004 13:34:41 -0000 Received: from dsl081-145-152.chi1.dsl.speakeasy.net (HELO firebird) ([64.81.145.152]) (envelope-sender ) by mail4.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 22 Jun 2004 13:34:40 -0000 Date: Tue, 22 Jun 2004 08:36:34 -0500 From: art yerkes To: erayo@cs.bilkent.edu.tr Cc: exa@kablonet.com.tr, gnu04@yahoo.com, caml-list@inria.fr Subject: Re: [Caml-list] Interface between Ocaml and C++ Message-Id: <20040622083634.78e2c662.ayerkes@speakeasy.net> In-Reply-To: <200406221414.04909.exa@kablonet.com.tr> References: <20040619045605.16162.qmail@web60908.mail.yahoo.com> <200406212224.07538.exa@kablonet.com.tr> <20040622014143.6e6870ab.ayerkes@speakeasy.net> <200406221414.04909.exa@kablonet.com.tr> X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40D83572.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yerkes:01 ayerkes:01 caml-list:01 2004:99 eray:01 ozkural:01 2004:99 yerkes:01 eray:01 ozkural:01 swig:01 swig:01 stub:01 generic:01 kde:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 22 Jun 2004 14:14:04 +0300 Eray Ozkural wrote: > On Tuesday 22 June 2004 09:41, art yerkes wrote: > > On Mon, 21 Jun 2004 22:24:07 +0300 > > > > Eray Ozkural wrote: > > > On Saturday 19 June 2004 10:29, art yerkes wrote: > > > > The SWIG module for Ocaml has support for a few STL > > > > types. If you use those interfaces as a guide, you > > > > could add support for more if the automatic wrapping > > > > doesn't suit. > > > > > > > > SWIG isn't perfect for everyone but some needs are > > > > met very well, including using templates. > > > > > > > > Look at http://www.swig.org/ > > > > > > How does it handle convert C++ templates to ocaml code, I wonder. I had a > > > design in my mind, but it required quite a bit of monkeying around. > > > What's their solution? > > > > The current solution is to specify which specializations of a given > > template will be needed, after which the specialized template classes are > > treated as ordinary classes. > > OK. Imagine client ocaml code that uses template class C < T >. I had imagined > that the specializations in the ocaml code ( C < int >, C < vector > >, ... ) could be determined automatically, after which the specializations > are generated in C++ stub code, and linked in... So I guess I had in mind a > more generic version of SWIG's approach, however I doubt this won't be a good > mapping.... Can you guys imagine any other alternatives, or should we avoid > templates in C++ libraries that want an ocaml binding (like KDE) ? In my experience, the C++ and ocaml type systems are different enough that determining specializations from caml code won't work well. Consider that: std::set std::set std::set are all different specializations of std::set on various representations of string in C++. The syntax to choose among them may not be easy for a user to write and keep track of. -- Hey, Adam Smith, keep your invisible hands to yourself! ------------------- 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