Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!vixen.cso.uiuc.edu!uchinews!cbgw2.lucent.com!nntphub.cb.lucent.com!alice!research.bell-labs.com!dujardin
From: dujardin@research.bell-labs.com (Eric Dujardin)
Subject: RE: Dylan -> Java??
X-Nntp-Posting-Host: juvvadi.tempo.bell-labs.com
Message-ID: <E03ps5.F9x@research.bell-labs.com>
Sender: usenet@research.bell-labs.com (netnews <9149-80593> 0112740)
Organization: Lucent Technologies, Bell Laboratories
References:  <comp.lang.dylan.c=US%a=_%p=Brightware._Inc.%l=BWNVFS02-961028182906Z-3401@bwnvfs02.brightware.com>
Date: Wed, 30 Oct 1996 18:24:05 GMT
Lines: 48

In article <comp.lang.dylan.c=US%a=_%p=Brightware._Inc.%l=BWNVFS02-961028182906Z-3401@bwnvfs02.brightware.com>, Adam Alpern <Alpern@brightware.com> writes:
|> 
|> One of the problems with that idea is that the Java byte-codes are not
|> language-neutral; their specific to Java. There's already been work done
|> to compile Ada95 and Scheme to Java byte-codes, so it's possible to host
|> other languages on the Java virtual machine.
|> 
|> I don't know anything about Ada95's object system, but I suspect it
|> would be fairly hard to target Dylan at the java machine because of
|> multiple inheritance and mulitple dispatch.
|> 

Agreed. Especially, Java's dispatch tables are hard-coded in the Java byte
code. This is not a problem for Ada95, which also supports single inheritance.
When compiling a Dylan program to Java bytecode, the run-time dispatch code 
should be part of the generated Java bytecode, a serious performance penalty
wrt Java and Ada 95.

An optimizing compiler could however detect the generic functions that do
not use multiple dispatch and multiple inheritance, and compile them to
generate Java-like dispatch tables. The performance penalty would be only 
observed for more complex generic functions. Using type information, for 
a given generic function the compiler may even use (fast) Java-like dispatch 
on some invocations and (slow) byte-coded dispatch for others. Assume the 
following classes and methods:

  A   B         m(A)
   \ /          m(B)
    C           m(C)
   / \ 	        m(D)
  D   E       	m(E)

Assume myA, myB and myC have respective types A, B and C: for invocations
m(myA) and m(myB), byte-coded dispatch should be used because the run-time
argument may be an instance of C and C multiply inherits from A and B.
However for m(myC) Java-like dispatch can be used because no multiple
inheritance appears below C.

I hope you get the idea. Now, who volunteers to implement that ? :-)

Eric


-- 
Eric Dujardin                             dujardin@research.bell-labs.com
Lucent Technologies - Bell Laboratories
Room 2C-234, 600 Mountain Avenue, P.O. Box 636      Phone: (908) 582-7153
Murray Hill, NJ 07974-0636, USA                     Fax  : (908) 582-5809
