TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

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

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

Print Reply
Subject:
From:
Scott Edgerton <[log in to unmask]>
Reply To:
Date:
Thu, 1 Oct 1998 11:59:03 -0500
Content-Type:
text/plain
Parts/Attachments:
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

ATOM RSS1 RSS2