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: 103376,733faa8b7b00c147 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!atl-c08.usenetserver.com!news.usenetserver.com!pc01.usenetserver.com!ALLTEL.NET-a2kHrUvQQWlmc!not-for-mail Date: Mon, 22 Aug 2005 08:28:43 -0500 From: "Marc A. Criley" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: basic ada question References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@usenetserver.com Organization: UseNetServer.com X-Trace: bfa4d4309d30ea13cf05719914 Xref: g2news1.google.com comp.lang.ada:4250 Date: 2005-08-22T08:28:43-05:00 List-Id: Simon Wright wrote: > I sometimes find myself using a mixed style, > > Invalidate (Current_Item (Using), > If_For_Instance => > Instance_Base_P (For_The_Instance)); I find the mixed style particularly valuable in situations where Boolean arguments are used. For example, if I had the procedure declaration: procedure Do_Something(To_This_Instance : in Item_Type; First_Time_Through : in Boolean); Invocations of this procedure could look like: Do_Something(Current_Instance, True); Correct, but that "True" doesn't tell you a whole lot. You could define your own two-value enumeration, with enumerals First and Not_First, but all you really need in that procedure is just plain old Boolean. You could also subtype Boolean, use renames clauses on, or define constants for, True and False, but that's just more code that could easily distract the reader, when all you really need is an invocation like this: Do_Something(Current_Instance, First_Time_Through => True); Within the procedure's implementation, the context and appropriateness of the Boolean argument is apparent, and the invocation of it using named notation for the Boolean parameter pulls some of that context into the caller for increased clarity. -- Marc A. Criley -- McKae Technologies -- www.mckae.com -- DTraq - XPath In Ada - XML EZ Out