From: elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!ub!dsinc!netnews.upenn.e du!uofs!guinness.cs.uofs.edu!beidler@lll-winken.llnl.gov (Jack Beidler)
Subject: Re: Access types and ALL
Date: 21 Apr 92 19:52:08 GMT [thread overview]
Message-ID: <10687@platypus.uofs.uofs.edu> (raw)
In article <1992Apr14.204743.19499@u.washington.edu>, mfeldman@milton.u.washing
ton.edu (Michael Feldman) writes:
Mike presents the following example,
|> Given a record type
|>
|> TYPE R IS RECORD
|> ...
|> F: Some_Type := Some_Value;
|> ...
|>
|> END RECORD;
|>
|> and an access type
|>
|> TYPE R_Ptr IS ACCESS R;
|>
|> ...
|>
|> RP : R_Ptr := NEW R;
|>
|> we can apparently select the field F in two ways:
|>
|> (1) RP.F
|>
|> (2) RP.ALL.F
|>
I wonder to what extent this anomoly is due to the desire of the language desig
ners to
make some of Ada not look like Pascal, resulting in the decision not to use the
'^'
to distinguish between an access variable and the object pointeed to by the acc
ess
variable. Once the '^' disappeared, the need for ".all" arise. To illustrate,
if
RP, QP : R_Ptr ;
then [in Ada] [in Pascal]
QP := RP ; -- copy the access variable value QP := R
P ;
QP.all := RP.all ; -- copy the object being pointed to QP^ := R
P^ ;
QP.all.F := RP.F -- looks like a mistake QP^.F := R
P^.F ;
Since were stuck with Mike's anomoly, I guess we need a style rule, like
"only use .all when you really have to!?". ".all" things considered, I'll stil
l
take Ada.
--
+-----------------------------------------------------------------------------+
| John (Jack) Beidler |
| Prof. of Computer Science Internet (VAX/VMS) BEIDLER@JAGUAR.UOFS.ED |
| University of Scranton Internet (SUN/UNIX) BEIDLER@GUINNESS.CS.UOFS.EDU|
| Scranton, PA 18510 Bitnet (VAX/VMS) BEIDLER@SCRANTON |
| |
| Phone: (717) 941-7446 FAX: (717) 941-4250 |
+-----------------------------------------------------------------------------+
reply other threads:[~1992-04-21 19:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox