TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
text/plain; charset=US-ASCII
Michael Feldman <[log in to unmask]>
Thu, 1 Oct 1998 11:59:03 -0500
Scott Edgerton <[log in to unmask]>
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
text/plain (56 lines)
____________________Reply Separator____________________
Subject:    Re: Ada is hard to learn....
Author: Michael Feldman <[log in to unmask]>
Date:       10/1/98 12:06 PM

[said Wes]
> Is it really?  Anyone ever seen anything like the following in an Ada
> book?
> Thinking in Java, by Bruce Eckel, Chapter 3:
> after taking three pages to introduce assignment, 95% of it devoted to
> aliasing, the section ends with
>   "Aliasing and its solution is a complex issue and, although you must
>   wait until Chapter 12 for all the answers, you should be aware of it at
>   this point so you can watch for pitfalls."
In context, I think this is a reasonable statement. Aliasing has
many meanings in computing. I think he means "assigning two pointers
to designate the same heap block." This _is_ difficult to get right.

For example, if P and Q designate the same value, and you deallocate
through P, what is the behavior if you try to dereference (access the
designated block of) Q?

  Once P has been deallocated, it's value is NULL
  (ref RM 13.11.2 (7)). Therefore, the value at Q
  should also be NULL (provided that that storage
  hasn't been reallocated for something else)

  Unless I'm missing something?

In fact, this is highly dependent on the implementation (that is,
whether, and if so how, garbage collection is supported). This is a
more-or-less language-independent issue.

Reading RM 13.11.2, on Ada.Unchecked_Deallocation, is instructive.
Indeed, no clear-cut answer is given to the above question; you are left
to deduce that it is implementation-dependent.

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?

Mike Feldman

  Perhaps this is why people say that "Ada is hard to learn"...

  Aliasing (on the surface) seems like a pretty
  straight forward concept.

  Scott Edgerton