Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Alternative Bytecodes for OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Goerzen <jgoerzen@c...>
Subject: Re: [Caml-list] Alternative Bytecodes for OCaml
On Wednesday 25 August 2004 10:05 am, skaller wrote:
> On Thu, 2004-08-26 at 00:26, John Goerzen wrote:
> > I come to OCaml from a Python background, and one of the most
> > interesting bits of technology for Python is Jython[1].
>
> Curious though why you'd want to... interfacing to C
> I can understand. But why bother with the JVM or Java?

Because you need to do *NOTHING* to get access to Java classes.  The 
Java type system is rich/strict enough (depending on your perspective) 
to be usable directly from Python, with no glue whatsoever.

Also because there are some interesting Java libraries that do not exist 
for C, or are not as easily usable.  JDBC is a common one.

And because Python is cross-platform, Java is, but compiled C is not.  A 
Jython program still can "run anywhere".

Example:

$ jython
Jython 2.1 on java1.4.1 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import java.lang.System
>>> p = java.lang.System.getProperties()
>>> for key in p.keySet().toArray():
...    print "%-30s: %s" % (key, java.lang.System.getProperty(key))
...
java.runtime.name             : Java(TM) 2 Runtime Environment, Standard 
Edition
python.cachedir               : /home/jgoerzen/.jython-cache
sun.boot.library.path         : /usr/lib/j2se/1.4/jre/lib/i386
java.vm.version               : Blackdown-1.4.1-beta
java.vm.vendor                : Blackdown Java-Linux Team
java.vendor.url               : http://www.blackdown.org/
path.separator                : :
java.vm.name                  : Java HotSpot(TM) Client VM

etc.

I wrote no glue code for this.  It just worked.  And that is the case 
with almost all Java APIs and libraries.  Jython can be used, in fact, 
as an interactive Java environment.

-- John

-------------------
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