TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"W. Wesley Groleau x4923" <[log in to unmask]>
Thu, 1 Oct 1998 11:57:10 -0500
text/plain (36 lines)
> I'd like to see some more context from Eckel's Chap. 3 section.
> Specifically, how does he introduce the aliasing issue for the case
> of Java? How does he define aliasing?

A more objective summary than what I just posted is:

In Java, almost everything is on the heap, and the names you manipulate
are really the names of the pointers.  So

   Number X;
   Number Y;
   X = Y

is (usually) equivalent to Ada's

   X : Number_Access_Type;
   Y : Number_Access_Type;
   X := Y;

Thus, a Java programmer has to think about aliasing almost continuously.

It's like telling an Ada programmer, "You are required to use access types
and the heap for anything larger than 32 bits.  And you are not allowed to
use ".all"   I'll tell you a workaround when the course is almost over."

Of course, much code will use the object's methods to change things, if
the object is well designed.  Perhaps I'll change my tune after more Java
experience, but at the moment, this seems counter-productive.

Eckel offers a FREE download of his book in PDF.  This is actually
more up-to-date than the published version.     (his C++ book is also there)