On Sat, Jun 7, 2008 at 6:43 AM, Richard W.M. Jones &lt;<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div>On Fri, Jun 06, 2008 at 11:34:04AM -0400, Colin Walters wrote:<br>
&gt; On Fri, Jun 6, 2008 at 4:11 AM, Richard W.M. Jones &lt;<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>&gt;<br>
&gt; wrote:<br>
&gt; &gt; One major reason is that it allows languages to be mixed and to call<br>
&gt; &gt; easily from one language to another. &nbsp;Free software dropped the ball<br>
&gt; &gt; on this (Parrot), and Mono/.Net is the only widely available<br>
&gt; &gt; implementation of this idea.<br>
&gt;<br>
&gt; It was *marketed* as such, but in fact many different languages have run on<br>
&gt; the JVM for a long time:<br>
&gt; <a href="http://www.robert-tolksdorf.de/vmlanguages.html" target="_blank">http://www.robert-tolksdorf.de/vmlanguages.html</a><br>
&gt; Some of them date to 1996.<br>
<br>
</div>This is getting pretty tedious. &nbsp;</blockquote><div><br>And offtopic for fedora-devel.&nbsp; But, it&#39;s a more interesting discussion than a complaint thread about nVidia drivers =)<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


In brief, the JVM has design issues<br>
that make implementing non-Java-like languages hard and/or slow. </blockquote><div><br>That&#39;s a rather sweeping generalization, which seems to have Clojure (<a href="http://clojure.sourceforge.net/" target="_blank">http://clojure.sourceforge.net/</a>), Scala, and JRuby all as counterexamples.&nbsp; Clojure in particular is wildly different from Java.&nbsp; Whether it was hard to implement is unknown, but the author is from what I&#39;ve seen an incredibly smart person.<br>


&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



particular issues are: lack of good support for closures, </blockquote><div><br>Closures are a language level construct - once you have garbage collection in the runtime they&#39;re easy, and most of the new JVM languages do have nice syntax for anonymous inline closures.&nbsp; What exactly you mean by &quot;good support&quot; is hard to say.<br>


&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">lack of<br>
polymorphic types (affects dynamically typed languages in particular,<br>
but also functional languages), </blockquote><div><br>Er...isn&#39;t the object system polymorphic?&nbsp; Are you talking about multiple dispatch?<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


inability to<br>
handle tail call optimization in mutually recursive functions (a<br>
serious concern in functional languages), </blockquote><div><br>This one is <a href="http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm">http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm</a> I believe.<br><br></div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">hideous native code interface, </blockquote>

<div><br>Reaching out and touching libc from the JVM, interactively:<br><br>Groovy Shell (1.5.6, JVM: 1.6.0-b09)<br>Type &#39;help&#39; or &#39;\h&#39; for help.<br>-------------------------------------------------------------------------------------<br>


groovy:000&gt; import com.sun.jna.*<br>groovy:000&gt; CLibrary<br>===&gt; interface CLibrary<br>groovy:000&gt; CLibrary.INSTANCE<br>===&gt; Proxy interface to Native Library &lt;/lib64/libcom_err.so.2@139792604163248&gt;<br>


groovy:000&gt; public interface CLibrary extends Library {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>groovy:001&gt;&nbsp;&nbsp;&nbsp;&nbsp; CLibrary INSTANCE = (CLibrary)Native.loadLibrary(&quot;c&quot;, CLibrary.class);<br>groovy:002&gt;&nbsp;&nbsp;&nbsp;&nbsp; long clock();<br>


groovy:003&gt; }<br>===&gt; true<br>groovy:000&gt; CLibrary.INSTANCE.clock()<br>===&gt; 6420000<br>groovy:000&gt; CLibrary.INSTANCE.clock()<br>===&gt; 6460000<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


lack of dynamic<br>
method invocation, </blockquote><div><br>What does that mean?<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">lack of eval, </blockquote>


<div><br>If any sane application relies on eval it&#39;s probably broken, but really once you have a language it&#39;s trivial to implement eval, because you probably already have an interactive toplevel which takes strings and turns them into code.<br>
<br>Where are you getting this list from?<br>

&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">lack of efficient tuples,</blockquote><div><br>Right, I don&#39;t think this one is &quot;soon&quot; but it will likely happen; <a href="http://blogs.sun.com/jrose/entry/tuples_in_the_vm" target="_blank">http://blogs.sun.com/jrose/entry/tuples_in_the_vm</a><br>

&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 lack of<br>
continuations (eg for Scheme). </blockquote><div><br>Realistically, I doubt there are many real-world Scheme programs out there that actually make *full* use of call/cc, as opposed to indirectly using it by calling into a e.g. green threading library which is implemented with call/cc.&nbsp; Not that there aren&#39;t interesting things one can do with full continuations; the RIFE framework (<a href="http://rifers.org/blogs/gbevin/2005/9/23/announcing_rifecontinuations" target="_blank">http://rifers.org/blogs/gbevin/2005/9/23/announcing_rifecontinuations</a>) has some examples.<br>

<br>That said, this one has a working prototype already:<br><a href="http://hg.openjdk.java.net/mlvm/mlvm/jdk/file/tip/callcc.patch" target="_blank">http://hg.openjdk.java.net/mlvm/mlvm/jdk/file/tip/callcc.patch</a><br>&nbsp;</div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp;Some of these are fixed in JSRs, but<br>
the process is incredibly slow and I&#39;m not aware of any fixes that<br>
actually ship in a JVM.</blockquote><div><br>These things change slowly, that&#39;s true.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Of course the JVM is Turing complete, so it is possible to implement<br>
any programming language on the JVM, but that doesn&#39;t necessarily mean<br>
it&#39;s going to be fast or good or allow you to practically call from<br>
any language to any language.<br>
<div><br>
&gt; Practically speaking there are many modern languages available such as<br>
&gt; Objective Caml: <a href="http://ocamljava.x9c.fr/" target="_blank">http://ocamljava.x9c.fr/</a><br>
<br>
</div>... if you give up all the native OCaml libraries, </blockquote><div><br>Sure, but if we&#39;re talking about the JVM versus .NET, you also have to give those up.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

duck typing, multiple inheritence, 64 bit ints, immediate objects, and a bunch of&nbsp;</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
other stuff.</blockquote><div><br>It&#39;s not clear to me those are fundamental tradeoffs vs just not implemented for some reason - e.g. what would blocking using &quot;long&quot; for 64 bit ints?&nbsp; Duck typing shouldn&#39;t be that hard.<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><br>
&gt; Ruby: <a href="http://jruby.codehaus.org/" target="_blank">http://jruby.codehaus.org/</a><br>
&gt; Python: <a href="http://jython.org/Project/" target="_blank">http://jython.org/Project/</a><br>
<br>
</div>Described here as &quot;a slower slightly more out of date version of<br>
Python, with fewer libraries&quot; / &quot;At this moment, writing libraries in<br>
Jython that would be in an attempt to make them usable to Jruby and<br>
Groovy folks seems like a fools errand.&quot;<br>
<a href="http://compoundthinking.com/blog/index.php/2008/02/27/jvm-as-platform-for-dynamic-languages/" target="_blank">http://compoundthinking.com/blog/index.php/2008/02/27/jvm-as-platform-for-dynamic-languages/</a><br></blockquote>


<div><br>There is largely never going to be a clean automatic way to do cross-nonnative language calls.&nbsp; Here by nonnative I mean languages which were designed to run on a custom runtime (not JVM/.NET).&nbsp; For example, Python strings are immutable, Ruby strings are mutable; if you were to pass a Python string into a Ruby function it couldn&#39;t act exactly like a Ruby string.&nbsp; The corner cases get even more bizarre once you start to look at more languages and more data types.<br>
</div></div><br>The more compelling long-term direction behind the JVM and .NET is taking the *good* things from different languages (e.g. OCaml&#39;s type inference and pattern matching, Python&#39;s clean syntax, generators) and throwing out the bad stuff (non-Unicode strings, bizarre/broken class models) and creating new languages that are native to the runtime; Microsoft has done this to OCaml with F#, Groovy is a much nicer and more strongly integrated dynamic language than Python/Ruby, etc.<br>
<br>Anyways, the point I wanted to refute is this:<br><br>&gt; &gt; Free software dropped the ball<br>
&gt; &gt; on this (Parrot), and Mono/.Net is the only widely available<br>
&gt; &gt; implementation of this idea.<br><br>And I believe that&#39;s been done.<br><br>