Subject: Re: HotJava?
To: None <netbsd-users@NetBSD.ORG>
From: Bakul Shah <bakul@netcom.com>
List: netbsd-users
Date: 04/06/1995 12:20:58
For the curious among you who haven't already read the
papers and formed an opinion:-), here is a mini review of
Java:
- To a first approximation, Java is very much like C++.
C++ haters can stop right here:-)/2
- Except that it is garbage collected (nice as you don't have to
worry about memory leaks). Java has constructors but not
destructors (a pity, since without destructors a class can not
do class specific cleanup).
- Uses the Unicode char set (nice).
- Has interfaces and packages in addition to classes. Useful
for constructing large programs.
- No multiple inheritance (they claim use of an interface
as a type provides some of the same facilities).
- Has exceptions.
- Pointer arithmetic not allowed on arrays. Their length is
determined at runtime. [But they missed obvious extensions
like assigning a sub-array to another array etc.]
- Some support for multithreading. For example,
synchronized (foo) {
....
}
execute the block only while object foo is locked by us.
(so atmost one thread at a time can be in the code
block). IHMO, this is a misuse of the word
`synchronized' -- I would've preferred `critical' or
`mutex' region. Anyway, I don't see how to do a
conditional critical region that does not use busy
waiting.
An obvious extension would've been to allow a list of
objects to get a lock on (the runtime system can then
grab locks in the order of their address and release
them in the opposite order to prevent a deadlock).
Apparently there is a sizable library though I haven't looked
at it.
If you like C++, this seems like a pretty neat language to
play with. I use C++ but my current favorite is Scheme.
I have tried to give an unbiased view but if some bias has
crept in or if I have made any mistakes, I apologize in
advance. Read the Java papers yourself when in doubt!
-- bakul (who should really be working on that damn tax return...)