From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Object-Oriented style question
Date: Sun, 08 Jan 2012 09:18:16 -0500
Date: 2012-01-08T09:18:16-05:00 [thread overview]
Message-ID: <wccfwfqi8gn.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 4f098fcb$0$6577$9b4e6d93@newsspool3.arcor-online.net
Georg Bauhaus <rm-host.bauhaus@maps.futureapps.de> writes:
> function Info (Item : in T) return Value;
This is the right way to do it. Don't use access types when
you don't need to. That goes double for anonymous access
types, and triple for cases involving run-time accessibility
checks, as the cases below do.
I can't think of any good reason to use access parameters
in Ada. Note: "access parameter" does not mean "parameter of
an access type", it means "parameter of an ANONYMOUS access type".
The "in" is just noise; I suggest you leave it out.
> function Info_1 (Item_Doubly_Indirect : access T) return Value;
> function Info_2 (Item_Doubly_Indirect : access constant T) return Value;
> function Info_3 (Item_Doubly_Indirect : not null access constant T) return Value;
All of the above exclude null. That is, "not null" is implicit
for Info_1 and Info_2. Calling any of these three with "null"
will raise Constraint_Error. That's necessary, because they're
dispatching on a Tag, and if the actual is null, there is no tag.
So Info_2 and Info_3 have identical semantics.
- Bob
next prev parent reply other threads:[~2012-01-08 14:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-08 12:45 Object-Oriented style question Georg Bauhaus
2012-01-08 12:52 ` Simon Wright
2012-01-08 13:25 ` Dmitry A. Kazakov
2012-01-08 14:18 ` Robert A Duff [this message]
2012-01-08 20:32 ` Martin Dowie
2012-01-08 20:52 ` Robert A Duff
2012-01-09 22:34 ` Adam Beneschan
2012-01-09 23:21 ` Robert A Duff
2012-01-10 8:34 ` Dmitry A. Kazakov
2012-01-09 8:55 ` Maciej Sobczak
2012-01-09 23:58 ` Georg Bauhaus
2012-01-10 8:47 ` Maciej Sobczak
2012-01-10 10:27 ` Dmitry A. Kazakov
2012-01-10 12:27 ` Georg Bauhaus
2012-01-11 8:54 ` Maciej Sobczak
2012-01-10 21:26 ` Randy Brukardt
2012-02-08 12:23 ` Yannick Duchêne (Hibou57)
2012-02-08 12:39 ` Yannick Duchêne (Hibou57)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox