comp.lang.ada
 help / color / mirror / Atom feed
* simple question?!
@ 2003-06-11  6:59 prashna
  2003-06-11 11:08 ` Wojtek Narczynski
  2003-06-11 11:31 ` simple question?! (choice of the name "access type") Larry Kilgallen
  0 siblings, 2 replies; 6+ messages in thread
From: prashna @ 2003-06-11  6:59 UTC (permalink / raw)


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.

Thanks,
Ashwath



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: simple question?!
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Wojtek Narczynski @ 2003-06-11 11:08 UTC (permalink / raw)


vashwath@rediffmail.com (prashna) wrote in message news:<d40d7104.0306102259.6a450043@posting.google.com>...

> Why access types in Ada are called as access types?
> Any pointers on this will be appreciated.

Access types are called as they are called to disassociate them from pointers.

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: simple question?! (choice of the name "access type")
  2003-06-11  6:59 simple question?! prashna
  2003-06-11 11:08 ` Wojtek Narczynski
@ 2003-06-11 11:31 ` Larry Kilgallen
  2003-06-11 19:13   ` Robert A Duff
  1 sibling, 1 reply; 6+ messages in thread
From: Larry Kilgallen @ 2003-06-11 11:31 UTC (permalink / raw)


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).

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: simple question?! (choice of the name "access type")
  2003-06-11 11:31 ` simple question?! (choice of the name "access type") Larry Kilgallen
@ 2003-06-11 19:13   ` Robert A Duff
  2003-06-11 20:33     ` Georg Bauhaus
  2003-06-12  8:58     ` Keith Thompson
  0 siblings, 2 replies; 6+ messages in thread
From: Robert A Duff @ 2003-06-11 19:13 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: simple question?! (choice of the name "access type")
  2003-06-11 19:13   ` Robert A Duff
@ 2003-06-11 20:33     ` Georg Bauhaus
  2003-06-12  8:58     ` Keith Thompson
  1 sibling, 0 replies; 6+ messages in thread
From: Georg Bauhaus @ 2003-06-11 20:33 UTC (permalink / raw)


Robert A Duff <bobduff@shell01.theworld.com> wrote:
: Kilgallen@SpamCop.net (Larry Kilgallen) writes:
: 
:> 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".

Hm. Dewar says, in http://www.adapower.com/lang/accessmem.html,

  "Finally, yes, you could use address arithmetic
  (good old pointer arithmetic), and indeed Ada has
  much more flexible pointer arithmetic than C (in
  Ada, unlike C, you can do arbitrary address
  arithmetic, e.g.  compare any two addresses, in a
  portable manner).  However, this is much lower
  level and will kludge up your code unnecessarily."


: 
: 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". 

Couldn't you say, "X is an access to Foo"?, in parallel to the
declaration?

: (I have the same complaint
: about protected types -- there's no such thing as a "protected".)

And here, "X is a protected value"?



-- Georg



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: simple question?! (choice of the name "access type")
  2003-06-11 19:13   ` Robert A Duff
  2003-06-11 20:33     ` Georg Bauhaus
@ 2003-06-12  8:58     ` Keith Thompson
  1 sibling, 0 replies; 6+ messages in thread
From: Keith Thompson @ 2003-06-12  8:58 UTC (permalink / raw)


Robert A Duff <bobduff@shell01.TheWorld.com> writes:
[...]
> 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".
[...]

I agree.  I remember the first time I read the Ada Reference Manual
(actually it was a copy of the 1979 preliminary manual from SIGPLAN
Notices).  I had a lot of trouble figuring out what the section on
access types was talking about until I realized they were essentially
the same thing as pointers.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-06-12  8:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2003-06-11 20:33     ` Georg Bauhaus
2003-06-12  8:58     ` Keith Thompson

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