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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38b27bed88e97415 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-20 10:17:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3E5517AE.1040003@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Question: Combination of Access and Constraining References: <1d13e1b4.0302200006.70207b86@posting.google.com> <9d795v0h3qa2922u8vodfhpfvprpre6ak2@4ax.com> <1d13e1b4.0302200720.9666350@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 20 Feb 2003 17:58:55 GMT NNTP-Posting-Host: 63.184.0.99 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1045763935 63.184.0.99 (Thu, 20 Feb 2003 09:58:55 PST) NNTP-Posting-Date: Thu, 20 Feb 2003 09:58:55 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:34288 Date: 2003-02-20T17:58:55+00:00 List-Id: Papandopulo wrote: >>Pointers are inherently bad. Why not: > > If they are ingerently bad why they are in > the language ? "Inherently bad" is not how I would put. However, large-scale pointer use is known to be the source of a family of errors. Pointers are needed far less in Ada than in some other languages, and it is a good idea to avoid them when you can. >>function Fn (Arg : Tp) return Natural; > > I have to use access type here. Since this is > simplified example. I have function accepting > several such array arguments each of which is > optional (null). This is still not a requirement to use access types. You can still say Null_Tp : constant Tp (1 .. 0) := (1 .. 0 => False); function Fn (Arg1 : Tp := Null_Tp; Arg2 : Tp := Null_Tp; ...) return Natural; Here you have a function with several such array arguments, each of which is optional, and each of which is a null array if not explicitly specified: Tp1 : Tp (1 .. 10) := ...; Tp2 : Tp (1 .. 1_000) := ...; X : Natural; ... X := Fn (Tp1); -- All except Arg1 are null X := Fn (Arg2 => Tp2); -- All except Arg2 are null X := Fn (Tp2, Tp1); -- All except Arg1 & Arg2 are null and so on. -- Jeff Carter "Monsieur Arthur King, who has the brain of a duck, you know." Monty Python & the Holy Grail