comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Access idiom
Date: Mon, 21 Jan 2008 22:15:04 -0600
Date: 2008-01-21T22:15:04-06:00	[thread overview]
Message-ID: <fn5jvd$8nu$2@jacob-sparre.dk> (raw)
In-Reply-To: 6j5lj.309998$Fc.80333@attbi_s21

"Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org> wrote in message
news:6j5lj.309998$Fc.80333@attbi_s21...
> Gene wrote:
> >
> > I'm at an impasse developing a graph data structure.  There are many
> > node types derived from a "most general" one.  Most of the node types
> > contain fields that are classwide access to child nodes.  Various
> > primitive procedures operate on nodes, dispatching on unnamed node
> > access types.  In many cases, the operations return such an access
> > child value.  Other "identity" ops just return the dispatching
> > parameter as classwide access.
>
> There should be no need for public access types or values in such a data
> structure. Hiding them should make the package easier to use, easier to
> implement, and safer.

Humm, I wouldn't go quite that far. If you need to return a reference to an
object (in the graph in this case) where the specific type of the object
isn't known, you have to use access types unless you can afford to copy them
all the time. We tried to do that with Claw, and it didn't work very well
(especially with user-defined extensions). We ended up adding returning of
access values in a few critical cases (like Get_Parent) in order to avoid
the bad effects of copying.

Summary: I wouldn't use "access" for any "in" parameters, but return values
and out parameters may need to be different.

                           Randy.





  parent reply	other threads:[~2008-01-22  4:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-20 19:57 Access idiom Gene
2008-01-21  1:01 ` Ludovic Brenta
2008-01-21  4:16   ` Gene
2008-01-21 15:37     ` Robert A Duff
2008-01-22  4:11     ` Randy Brukardt
2008-01-22  4:11     ` Randy Brukardt
2008-01-21  9:05 ` Dmitry A. Kazakov
2008-01-21 18:15 ` Jeffrey R. Carter
2008-01-22  3:56   ` Gene
2008-01-22  5:10     ` Gene
2008-01-22  9:01     ` Dmitry A. Kazakov
2008-01-22 18:47     ` Jeffrey R. Carter
2008-01-22  4:15   ` Randy Brukardt
2008-01-22  4:15   ` Randy Brukardt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-21  7:12 Grein, Christoph (Fa. ESG)
replies disabled

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