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 OAA12112; Fri, 15 Feb 2002 14:53:05 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA11154 for caml-list@pauillac.inria.fr; Fri, 15 Feb 2002 14:53:04 +0100 (MET) 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 XAA30634 for ; Thu, 14 Feb 2002 23:15:48 +0100 (MET) Received: from ediacara.ne.mediaone.net (ediacara.ne.mediaone.net [24.91.59.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g1EMFlH28767 for ; Thu, 14 Feb 2002 23:15:47 +0100 (MET) Received: (from mcharity@localhost) by ediacara.ne.mediaone.net (8.11.6/8.11.6) id g1ELfxL19512; Thu, 14 Feb 2002 16:41:59 -0500 Date: Thu, 14 Feb 2002 16:41:59 -0500 Message-Id: <200202142141.g1ELfxL19512@ediacara.ne.mediaone.net> To: caml-list@inria.fr Subject: [Caml-list] Inline::OCaml ? From: Mitchell N Charity Reply-to: mcharity@lcs.mit.edu Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I hope someone is working on an Inline::OCaml for Perl. Using Perl's Inline::CPP, one can write C++ code #! /usr/bin/perl use Inline CPP => <<'ENDOFCODE'; class counter { public: counter() { n = 0; } void incr() { ++n; } int get() { return n; } private: int n; }; ENDOFCODE and use it from Perl my $x = new counter(); $x->incr; print $x->get; and thus from Python from perlmod import PerlClass counter = PerlClass("counter") x = counter() x.incr() print x.get() It would be nice if one could also write #! /usr/bin/perl use Inline OCaml => <<'ENDOFCODE'; class counter2 = object val mutable n = 0 method incr = n <- n+1 method get = n end;; ENDOFCODE my $y = new counter2(); $y->incr; print $y->get; Creating an Inline::OCaml is a non-trivial project, but as Inline packages have been created for C, C++, Java, Guile, Python and other languages, it should be a feasible one. And it will get easier as Inline matures from its current alpha/beta-ish state, though there may be some opportunity cost to waiting. It appears a "multi-lingual" programming threshold is currently being approached. With pyperl and Inline::Python, python and perl objects can interoperate with increasing transparency. With perl's Inline::C, Inline::CPP (C++), and even Inline::Java, code in those languages can also be incorporated. Now would seem a good time to make the case that OCaml is a better choice than C or C++ (or Java), for writing scripting language extensions which need to be developed rapidly and run fast. Currently, one speeds Perl and Python programs by using extensions written in C, and by rewriting bottlenecks, also in C. Having Perl / Python packages implemented in OCaml would both expose a large user population to the existence of OCaml, and by requiring/motivating the installation of ocaml, increase its accessibility. Thus increasing the number of people who get to see, try, and ultimately use OCaml. The market forces which constrain OCaml when people decide "What language should my _project_ be written in?", are rather different when they ask "What language should some compartmented speed hack be written in?". And few care about the language of an extension, as long as it does what they want, and the installation is easy. So there seems to be a possible opportunity here for OCaml to gain exposure and expand its user base. Just a thought, Mitchell Charity (back to writing a Perl/Python extension in C and C++... sigh...) Some links: Inline http://inline.perl.org/ http://search.cpan.org/search?mode=module&query=Inline%3a%3a and, current as of 2002-Feb-13: http://search.cpan.org/doc/INGY/Inline-0.43/Inline-API.pod http://search.cpan.org/doc/INGY/Inline-0.43/Inline.pod http://search.cpan.org/doc/INGY/Inline-0.43/C/C.pod http://search.cpan.org/doc/INGY/Inline-0.43/C/C-Cookbook.pod http://search.cpan.org/doc/NEILW/Inline-Python-0.20/Python.pod http://search.cpan.org/doc/PATL/Inline-Java-0.31/Java.pod pyperl http://conferences.oreillynet.com/cs/os2001/view/e_sess/1437 http://www.zope.org/Wikis/zope-perl/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr