This directory contains tutorial examples for language interoperability.

** Subdirectory overview

basic/ - a few very basic examples, each showing a minimal number of features

threads/ - examples of using threads across languages

(See README.txt in each subdirectory for a more complete explanation.)

** Description of the pal-vm language interoperability approach

Language interoperability is based on the "Flexible Language Interoperability
Framework" (FLIF).  Version 1.0 of FLIF is described in Palcom WN#85.  The
current version of FLIF is 3.0, and is described (briefly) here; the principles
for run-time interaction are basically the same (share objects between
languages), but the implementation has evolved quite a bit (although there
currently are a few implementation holes that we need to work around).

From the point of view of the Java programmer, any top-level Java class can be used 
from other programming languages, and components implemented in other programming
languages can be used from Java.  Currently, only concrete classes are visible
across languages.  Smalltalk methods are visible to Java using a name based on the 
first part of the Smalltalk selector and the type annotation on the method.

From the point of view of the Smalltalk programmer, any Smalltalk class can be
annotated with types making it useable from other programming languages, and
components implemented in other programming languages can be used from Smalltalk.
Java methods are visible to Smalltalk using a name based on the Java method name
and with arbitrarily named argument selectors.

** Implementation/usage notes

Compiling Java programs: pal-dev-j sometimes incorrectly raises an error even
when a .pra file was successfully produced, typing "make" again should normally
allow the process to continue.

Making Smalltalk classes available to Java: make sure to annotate methods with
Java-compatible type names (either Java names, primitive types for
e.g. int/Integer, or names of other Smalltalk classes also made available to
Java).  Make sure to give pal-dev-st the argument '--generate-extern java', and
to give pal-dev-j the argument '-sourcepath EXTERNJAVA' which is where
pal-dev-st currently places the files that describe the Smalltalk interface to
Java.  (These files will be eliminated in the near future.)

Calling Smalltalk system classes: pal-dev-j currently needs to compile against
type-instrumented classes compiled in the local directory, which does not easily
work with the current approach (will be remedied soon).  Currently, the solution
is to make a small wrapper when calling system functionality, as shown in the
basic/system example.
