Free Java and Else

Free Java

Today I sent a non-open letter to Bob Sutor, the IBM guy raising
all the fuss with Sun about making Java free. I figured, why couldn’t
IBM work with the already existing free world, in addition to talking
to Sun? I’ll post if I get an interesting response.

gcjx

This weekend, gcjx
generated its first 33 .class files. The generated code for Object is
basically correct (it has a minor pessimization which is actually
caused by a semantic analysis bug). Another milestone down.

Language stuff

graydon writes: “the high level free software platform in 2004 is
C++ and python”.

I think this pair misses some fundamental features of Java and C#.
First, C++ is just much more complicated than these languages, and in
my opinion much of this complexity is unwarranted. It doesn’t provide
enough benefit for the cost it imposes. Second, just because one can
write safe C++ isn’t the key point — the point is that Java is safe
by default. C++ does give you more tools than C to make your programs
less buggy, but as I see it Java eliminates certain classes of bugs
entirely. This comes at a price, but I find in practice I don’t mind
paying it.

As for Python, personally I prefer static type checking. As far
as I know, Python doesn’t have this.

One other nice thing about Java that is often overlooked is that
the tight integration of the language and the libraries. This idea
is really contrary to C and C++ design principles; I’ve seen C
hackers complain about this any number of times. However, it does
give you nice things like the new enhanced for
construct.

It’s mostly gas, though. I don’t want to come off as a rabid
Java proponent, since I’m not that. I do like writing programs in
it. But, on the other hand, gcjx is written in C++, and the writing
does go reasonably well. I find I’m confused from time to time;
there have been occasions where I can’t tell what g++ is trying to
tell me, or more embarrassingly, occasions when I can’t tell whether
a bug is in my code or in the compiler. These are just minor
problems in the overall scheme of things.

One actual problem is compilation time. It takes unbelieveable
resources to compile gcjx, which by any sane measure is a small
program. I realize that use of STL implies a cost, and that STL isn’t
“small”, but in my opinion the current cost is simply much too high
for using the standard container classes. I tend to see this, perhaps
unfairly, as a result of semantic choices made by C++, e.g.,
instantiating templates based on concrete types. Java uses
constraints here instead, which are less powerful but simpler to
check. It’s hard to make a fair comparison, though, since one uses
different styles when writing in the different languages.

This brings up an interesting aside, which is that C++ led the way
into generic programming. Now Java and C# are both adding generics.
In Java, unfortunately, this complicate the language in some strange
ways. The addition of generics necessitated the addition of covariant
returns, introduced some deprecated-at-introduction features (a bad
sign, ugh), and turned the already complicated method name lookup
algorithm into a 2-stage process which is yet to be fully documented
in public form (this process may only be a requirement due to
auto-boxing, but this feature was added only due to generics not
including primitive types…). To me this suggests that the next OO
programming language should have generics designed in at the
beginning.

Be the first to leave a comment. Don’t be shy.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.