Java's modules rock? (was Re: election details *PLEASE READ*)

Lex Spoon lex at lexspoon.org
Wed Feb 28 22:27:04 UTC 2007


Andreas Raab <andreas.raab at gmx.de> writes:
> J J wrote:
> > Namespaces ok, but the way they have been done is not always that
> > great.  Modules are pretty much the same thing, and interfaces?  No.
> > Traits are much better then interfaces imo.
> 
> Modules is one area where IMO Java shines. Not necessarily because of
> the language part but because of the whole ClassLoader/JAR/Applet
> pipeline (just run Dan's SqueakOnJava in the browser and then think
> about what must be true to be able to handle that in a reasonably
> secure fashion).

Security I'll give you.  That would be great if Squeak could do that.
Python, incidentally, can do such things with its module system.  We
could have that too, but having it plus also keeping our existing code
running is a really hard pair of features.

Anyway, the rest of Java's modules system I don't like at all.  Let me
mention two major problems.

First, it is troublesome to assemble groups of jar's along with their
dependencies for both compilation and execution.  It takes a while to
track down all the necessary jar's, and it is hard to debug errors
having to do with using the wrong version or with jar's that are only
accessed on some control paths.  To contrast, the ELF loader on Linux
blows it away.  You compile with -lm and get the math library plus its
dependencies.  You then run the resulting executable, with no extra
arguments at all.  Why doesn't Java work like that?  Is C technology
too advanced?


Second, linking jar's of different versions gives a lot of spurious
errors.  Package Universes for Squeak has a big advantage over the
same thing for Scala in that department.  It is rare for a Scala
package to remain usable for longer than a couple of months, because
the packages it links against keep getting changes in the signatures
and the Java type checker complains.  To contrast, some of the
packages in the 3.9 stable universe are over a year old.

It is to the point that Scala users periodically request on the list
that its version of package univeres use a non-JAR format.  I wish I
had time to design one, because I think they are right.  JAR is an
awkward format.

-Lex






More information about the Squeak-dev mailing list