'java sucks' - a view from outside squeakland

David Chase squeak-dev at lists.squeakfoundation.org
Wed Oct 23 01:54:58 UTC 2002


At 12:17 PM 10/21/2002 -0700, Tim Rowledge wrote:
>Weaponry.
>
>http://www.jwz.org/doc/java.html

It's a little dated.  I'll note the points that don't
hold -- those that remain, still do, more or less (one
or two behaviors I think are features, not bugs, but
either way, the behavior remains).  Personally, I've
found that the (un)suitability of Java seems to vary
with the application; I was very bugged by it while
writing a DB-presenting/manipulating web server, but
not at all bugged by it when working on a compiler.
A good IDE (e.g., Eclipse) helps tons, and it does
manage to get more benefits out of the static type
system (I don't want to restart the argument, except
to point out that static typing has both costs and
benefits, and if the benefits are increased, it will
more often be a net win).

> It's far from obvious how one hints that a method
> should be inlined.

Assume that if it is profitable to be inlined, and
can be inlined, it probably will be.  This is true
of both HotSpot and the native compiler (BulletTrain)
that I've worked on.

> I can't seem to manage to iterate the characters in a
> String without implicitly involving half a dozen method
> calls per character.

At least one compiling-VM treats those alleged method
calls very specially, and also performs analysis-driven
(i.e., mechanically proven safe) removal of all the implicit
bounds checks.

> As far as I can see, there's no efficient way to implement `assert'

Added to the language in 1.4, but otherwise entirely true.

> By having `new' be the only possible interface to allocation,
> and by having no back door through which you can escape from
> the type safety prison

Tough shit, plus "new" is also very fast in modern VMs.  I've
played the allocate-from-a-pool game, and when I was done, the
code was slower than just allocating and GCing.

> Relatedly, there are no ``weak pointers.''

They added weak references, phantom references, soft references,
and special JNI GlobalWeak references.  I'm not sure why they
quit when they only had four different behaviors.

> The locking model is broken. 
> > First, they impose a full word of overhead on each and
> > every object.

The overhead is less than one word per object.  Hash info,
lock, and gc info can all fit into a single 32-bit word.

David Chase





More information about the Squeak-dev mailing list