From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Depth First Search of a Char_Matrix?
Date: Sat, 27 Apr 2013 13:04:20 -0700 (PDT)
Date: 2013-04-27T13:04:20-07:00 [thread overview]
Message-ID: <3ace3792-6e8a-4958-b6f9-52779282f3dd@googlegroups.com> (raw)
In-Reply-To: <lyppxfsrbu.fsf@pushface.org>
On Saturday, April 27, 2013 1:31:49 PM UTC-6, Simon Wright wrote:
> Shark8 writes:
>
> > On Saturday, April 27, 2013 11:25:57 AM UTC-6, Jeffrey Carter wrote:
> >>
> >> There is absolutely no reason to use access types (especially not
> >> anonymous access types) or addresses for this problem.
> >
> > Sure, but there's no real reason not to: the illustration was simply a
> > DFS on something that might-not-exist and so null/some-object map to
> > that perfectly fine. (It's an error to ask "what color is the piece at
> > X,Y?" when the element X,Y contains no piece; this situation must be
> > addressed somewhere, and access/null works.)
>
> As a general rule of thumb it is a bad idea to use access types unless
> you Absolutely Have To.
>
> To solve this problem, a discriminated record would have done just fine:
>
> type Cell (Occupied : Boolean := False) is record
> case Occupied is
> when True =>
> Piece : Piece_Colour;
> Alive : Boolean;
> when False =>
> null;
> end case;
> end record;
Doh! So obvious.
>
> And anonymous access types are worse, see the recent problems with
> anonymous task access types.
I know; I was the one who started that thread -- and that's why I've been spending my recent time thinking about access types (which probably explains why that was what popped into my head first).
next prev parent reply other threads:[~2013-04-27 20:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 14:09 Depth First Search of a Char_Matrix? Alex
2013-04-27 15:35 ` Shark8
2013-04-27 17:25 ` Jeffrey Carter
2013-04-27 18:16 ` Shark8
2013-04-27 18:48 ` Dmitry A. Kazakov
2013-04-27 18:58 ` Shark8
2013-04-27 20:16 ` Dmitry A. Kazakov
2013-04-27 19:31 ` Simon Wright
2013-04-27 20:04 ` Shark8 [this message]
2013-04-28 3:26 ` Jeffrey Carter
2013-04-27 16:27 ` Alex
2013-04-27 16:34 ` Shark8
2013-04-27 16:51 ` Alex
2013-04-27 16:55 ` Alex
2013-04-27 19:05 ` Shark8
2013-04-27 22:54 ` Alex
2013-04-27 22:56 ` Alex
2013-04-27 23:34 ` Shark8
2013-04-27 23:38 ` Alex
2013-04-29 20:55 ` Alex
2013-04-29 23:40 ` Jeffrey Carter
2013-04-30 10:49 ` AdaMagica
2013-04-28 10:50 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox