[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Book again, was Dylan (was: ARC)



Ken Anderson (Sun, 02 Dec 2001 18:02:54 EST) proclaims:
> At 03:54 PM 12/2/2001, Oliver Steele wrote:
> >Better, I think, is to make use of libraries written in other languages.
> >.NET/Mono is a path to this; Minotaur and the various Python/Java
> >interoperability libraries (which support cross-language calls, exceptions,
> >and subclassing --- as David Moon planned to eventually do for the Apple
> >Cambridge languages and implementations and C++) are some language-specific
> >success stories.
> 
> JScheme is a scheme dialect, i use every day, with transparent access to 
> Java. So, it takes a page of code or so to interface to things like applets, 
> servlets, database, and mail.

There is a bit of a pitfall you stumble into if you have two languages with
ALMOST the same semantics and try to integrate them tightly -- e.g.
subclassing Java classes with (J)Python classes.  I tried this as a rapid
development approach recently, and then subsequently spent the rest of the
week trying to find a non-existant bug in my code; it turns out that python's
method dispatch semantics are close enough to java's to make overriding of
java methods with python methods work most of the time, but NOT if there is
overloading going on at the same time.  After I had struggled out of the
tarpit, I was able to use my hybrid scheme to quickly hammer out python test
code that eventually gets graduated to Java. So it worked, kinda.

But I still was pretty badly burned.  This cross-language developlment is hard
stuff. The problem is that when languages are almost, but not quite, entirely
like each other, the line of what ought to work cross boundaries becomes hard
to predict.

I imagine that the reason Ken hasn't been burned yet is that scheme and java
are sufficiently different to make him think twice about crossing language
domains; I suspect that it is always obvious whether he is applying a scheme
function or invoking a java method, so it is clear where to use another set of
semantics. That is completely transparent in jython/java interactions.

ON WITH THE QUESTION:

Not entirely incidentally, this is exactly what I had hoped to learn at LL(1):
a predominant feature of LLs is that they tend to play in language-
heterogenous, quickly evolving environments.  If a language is a tool, one
should use the right tool for the job in order to maximize efficiency. This is
clearly the idea behind .NET. But if every tool is a langauge, how do we
resolve the semantic interactions that arise from tightly coupling them? One
is tempted to claim "Since they all run under the CLR, they all have the same
semantics!". But that isn't the case, as my Jython/Java troubles taught me.