From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a9916530bf157e77 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.217.195 with SMTP id hn3mr34891765qab.5.1367093060903; Sat, 27 Apr 2013 13:04:20 -0700 (PDT) X-Received: by 10.50.164.200 with SMTP id ys8mr812421igb.1.1367093060690; Sat, 27 Apr 2013 13:04:20 -0700 (PDT) Path: ef9ni27140qab.0!nntp.google.com!s14no241389qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Apr 2013 13:04:20 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <87c89205-7fee-4d88-b4ab-08d26c03219b@googlegroups.com> <51cf6f75-c19b-4e08-a2be-f3133eedccfa@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3ace3792-6e8a-4958-b6f9-52779282f3dd@googlegroups.com> Subject: Re: Depth First Search of a Char_Matrix? From: Shark8 Injection-Date: Sat, 27 Apr 2013 20:04:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-04-27T13:04:20-07:00 List-Id: 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).