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 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.180.182.6 with SMTP id ea6mr2921746wic.4.1367665892319; Sat, 04 May 2013 04:11:32 -0700 (PDT) Path: p18ni66813wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.138.MISMATCH!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!backlog1.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.stack.nl!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Depth First Search of a Char_Matrix? Date: Sat, 27 Apr 2013 20:31:49 +0100 Organization: A noiseless patient Spider Message-ID: References: <87c89205-7fee-4d88-b4ab-08d26c03219b@googlegroups.com> <51cf6f75-c19b-4e08-a2be-f3133eedccfa@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx05.eternal-september.org; posting-host="abea7aea1fa87bdeaf110ddb7626f1db"; logging-data="30663"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tHQPBkdubwV/SDQPspBW49uiY2fzlsl8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:0uEBe8VNMk6Y+HmgVfCwwo7B2kg= sha1:FpBs4qMEHt2IpsqARUf+ecPYtWs= X-Original-Bytes: 2285 Content-Type: text/plain Date: 2013-04-27T20:31:49+01:00 List-Id: 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; And anonymous access types are worse, see the recent problems with anonymous task access types.