[MUD-Dev] Why not compile java into object code?
Caliban Tiresias Darklock
caliban at darklock.com
Fri Feb 27 00:09:50 CET 1998
On 08:18 PM 2/26/98 +0000, I personally witnessed Ben Greear jumping up to
say:
>
>Since this is one of the largest bodies of opinionated, hard core coders I
>know of, I'll pose the question here. It's mostly off topic of course.
>
>What would it take to compile java down into object code (.o files)?
A complete perversion of everything Java stands for. The whole idea is
'write once, run everywhere'. If you want object code, use C++.
>It's not being done...but I wonder why? I don't care if I have to compile
>for each platform...if I compile just for win95 80% of my users will enjoy
>a tremendous speedup....
Use Microsoft J++. It generates much faster bytecode, which is
unfortunately not always compatible with JVMs from other vendors, but who
cares? Everyone's using Microsoft anyway, right? What difference does it
make if some of the people who would normally be able to run it can't?
Well, to hear Sun's side of it, the entire POINT of Java is compatibility
and if you design an incompatible Java compiler then you're not really
doing Java. I tend to agree.
Java is a language built for a specific purpose. You wouldn't write an
operating system in BASIC. You wouldn't write a device driver in APL. Could
you? Probably. But they're the wrong tools for the job. If you go out and
buy a screwdriver, you can't expect it to hammer nails, and wishing someone
would make a screwdriver with a stainless steel handle is a lot less
productive than going out and buying a hammer. If you want native code,
quit working in Java and pick up a real language. You'll lose a lot of
Java's nice features, but you'll lose all the restrictions, too. The
question is what's more important -- the nice features of Java, or the nice
features of C++? Sooner or later you have to decide whether you're going to
buy the station wagon or the convertible, and live with whatever choice you
make.
>On a similar level, is this what JIT compilers do?
Nope. JIT compilers take actual Java source and make it into bytecode. In
other words, you don't have to compile your Java if you use a JIT compiler,
because the JIT compiler does it for you. Excellent during development. Not
so excellent in distribution.
>If so, could not
>someone write a JIT that produces an ordinary exe?
It occurs to me that it may very well be forbidden under Sun's license
agreement to create a native-code compiler for Java. Bytecode is pretty
much an integral part of what Java is, after all.
More information about the mud-dev-archive
mailing list