[1738] in java-interest

home help back first fref pref prev next nref lref last post

A few queries...

daemon@ATHENA.MIT.EDU (Llew Mason)
Fri Sep 15 12:41:25 1995

From: Llew Mason <mason_l@ee.uwa.edu.au>
To: "java-interest@java.sun.com" <java-interest@java.sun.com>
Date: Fri, 15 Sep 1995 21:35:04 +-800

Hi all,

I've been evaluating Java for the past few days and have a few queries =
on the language. (keep in mind that I have been using the NT 1.0a3 =
release and haven't seen the development kit)  Please correct me if =
anything I have stated below is incorrect.

1)   Pass-by-value vs pass-by-reference vs pass-by-const-reference

  As far as I could tell this wasn't discussed in any of the provided =
documention.  Java currently passes class arguments by non-const =
reference.  I assume that the currently reserved const keyword will =
allow argument passing by const reference eventually.  I can't see any =
point in Java ever providing pass-by-value support.
  Why was argument passing by non-const reference chosen as the default? =
 This seems to be a dangerous practice and inconsistent with Java's =
efforts at removing unsafe practices from the C++ language. (removal of =
pointers was a good start)

2)   Meta-classes (template classes for those unfortunate C++ people)

  There seems to be no way to implement meta-classes within Java.  The =
interface mechanism allows for class methods to operate on any class =
which implements a particular interface, but cannot guarantee the =
homogeneity of instantiated classes.  This makes usage of classes like =
Vector unsafe (not to mention inelegant) since all elements need to be =
typecast to the required type upon extraction.

3)   Operator overloading

  Why was this omitted from the Java language?  This is one of the =
'neat' features of languages like C++. (although I'd prefer overloaded =
operator support like that provided by ML, where new operators can be =
defined and operator precedence can be redefined)
  Web applets would rarely require operator overloading, but if Java is =
intended to be used for any serious development where mathematical =
classes are required then it quickly becomes unwieldy.
  Specifying complex numbers as z.mul(z).plus(c) for Mandelbrot =
generation is ugly compared with z =3D z * z + c.  Reading code =
consisting of operations on complex number, vector, matrix and tensor =
classes becomes almost impossible without overloaded operators being =
defined for these classes.
  I admit that operator overloading can be abused, but then so can =
function naming.

4)   AWT class package DisplayItem class

  Why is the DisplayItem class inherited from the Browser.Observable =
class?
I would think that the base GUI package should not take inheritance from =
specific application classes. (Like the HotJava application)


Overall I'm quite impressed with what I've seen of Java.  With native =
machine-code compiler support, meta-classes and operator overloading I =
see no reason why Java couldn't become as popular as C++.

Llew Mason
 
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post