comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: simple question?! (choice of the name "access type")
Date: 11 Jun 2003 15:13:57 -0400
Date: 2003-06-11T15:13:57-04:00	[thread overview]
Message-ID: <wccof1477gq.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: QPS8qGYHmxOK@eisner.encompasserve.org

Kilgallen@SpamCop.net (Larry Kilgallen) writes:

> In article <d40d7104.0306102259.6a450043@posting.google.com>, vashwath@rediffmail.com (prashna) writes:
> > Hi all,
> > Why access types in Ada are called as access types?What can these
> > types access?why not it is called by some other name?Any pointers on
> > this will be appreciated.
> 
> The value of an access type can be used to access objects of some
> other type (designated when the particular access type was declared).
> 
> The other name which access types might have been called is "pointers",
> but they lack many of the aspects (drawbacks) of pointers in other
> languages:
> 
> 		You cannot arbitrarily add to access types as one would
> 			do in C to walk down an array (or walk off the
> 			end of an array).

But Ada is descended from Pascal, and you can't do pointer arithmetic in
Pascal, either.  Yet Pascal calls them "pointers".

I think it was silly and obfuscatory for Ada to call them "access
types".  It also makes talking about them harder: for most types,
there's a simple noun you can use to refer to values or objects of the
type.  If a program says:

    type T is range 1..10;
    X: T;

you can say "X is an integer".  The value of integer types are
"integers".  But for access types you can't say "X is an access", nor
"the value of access types are accesses".  (I have the same complaint
about protected types -- there's no such thing as a "protected".)

IMHO, access types should be called "pointer" or "reference" types.

> 		Implementations are not required to implement access
> 			types as a pointer.

I would say, "Implementations are not required to implement access types
as machine addresses."  To me (coming originally from a Pascal
background), "pointer" is a higher level concept than a machine address,
and "pointer" does not imply that address arithmetic is allowed.
A pointer is simply something that points.

- Bob



  reply	other threads:[~2003-06-11 19:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-11  6:59 simple question?! prashna
2003-06-11 11:08 ` Wojtek Narczynski
2003-06-11 11:31 ` simple question?! (choice of the name "access type") Larry Kilgallen
2003-06-11 19:13   ` Robert A Duff [this message]
2003-06-11 20:33     ` Georg Bauhaus
2003-06-12  8:58     ` Keith Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox