comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Access Types
Date: 1999/07/21
Date: 1999-07-21T00:00:00+00:00	[thread overview]
Message-ID: <wcchfmxsy3y.fsf@world.std.com> (raw)
In-Reply-To: 7mkgqq$elo$1@dailyplanet.wam.umd.edu

rayoub@wam.umd.edu (Ronald Ayoub) writes:

> For this line of code:
> 
> type File_Access is access constant File_Type;
>
> I understand this to mean that File_Access points to a File_Type variable
> which cannot be changed but the value pointed to can be changed. Is this
> correct?

Um, the thing pointed to *is* the File_Type variable.  Maybe this will help:

    type Pointer_To_Const is access constant Integer;
    type Pointer_To_Var   is access all      Integer;

    X: Pointer_To_Const := ...;
    Y: Pointer_To_Var := ...;

    Z: constant Pointer_To_Const := ...;
    W: constant Pointer_To_Var := ...;

    X.all := 1; -- Illegal.
    X := new Integer'(3); -- OK.
    Y.all := 1; -- OK.
    Y := new Integer'(3); -- OK.
    
    Z.all := 1; -- Illegal;
    Z := new Integer'(3); -- Illegal.
    W.all := 1; -- OK.
    W := new Integer'(3); -- Illegal.
    
    ...

X and Y are constants; Z and W are variables.

The objects Y and W point to are variables.
The objects X and Z point to might be constant or variable,
but they're read-only via X.all and Z.all.

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1999-07-21  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-15  0:00 Access Types Ronald Ayoub
1999-07-21  0:00 ` Robert A Duff [this message]
1999-07-22  0:00   ` Steve Folly
1999-07-23  0:00     ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2007-07-01  0:39 access types Brian May
2007-07-01  1:54 ` Robert A Duff
2007-07-01  7:52   ` Dmitry A. Kazakov
2007-07-01 14:57     ` Robert A Duff
2007-07-01 19:41       ` Dmitry A. Kazakov
2007-07-02  0:12         ` Robert A Duff
2007-07-02  8:06           ` Dmitry A. Kazakov
2007-07-02 15:37       ` Adam Beneschan
1998-05-27  0:00 Access types jsanchor
1998-05-28  0:00 ` Jerry van Dijk
1998-05-29  0:00   ` jsanchor
1998-05-30  0:00     ` Jerry van Dijk
replies disabled

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