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,a1ce307c10055549 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-16 14:12:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!c03.atl99!cyclone2.usenetserver.com!news.webusenet.com!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-binary.blueyonder.co.uk.POSTED!53ab2750!not-for-mail User-Agent: Microsoft-Entourage/10.1.1.2418 Subject: Re: calenday (was Re: IBM Acquires Rational Ada From: Bill Findlay Newsgroups: comp.lang.ada Message-ID: References: <3DF1615C.7AAAC86E@adaworks.com> <8db3d6c8.0212091445.12594821@posting.google.com> <3DF628C4.7090607@cogeco.ca> <3DF6653D.3030603@cogeco.ca> <8db3d6c8.0212101850.51506572@posting.google.com> <3DF8D33F.9020205@cogeco.ca> <3DFE1D97.6020109@cogeco.ca> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Date: Mon, 16 Dec 2002 22:11:48 +0000 NNTP-Posting-Host: 80.195.52.70 X-Complaints-To: abuse@blueyonder.co.uk X-Trace: news-binary.blueyonder.co.uk 1040076717 80.195.52.70 (Mon, 16 Dec 2002 22:11:57 GMT) NNTP-Posting-Date: Mon, 16 Dec 2002 22:11:57 GMT Organization: blueyonder (post doesn't reflect views of blueyonder) Xref: archiver1.google.com comp.lang.ada:31919 Date: 2002-12-16T22:11:48+00:00 List-Id: On 16/12/02 21:41, in article mailman.1040074922.28258.comp.lang.ada@ada.eu.org, "David C. Hoos" wrote: [snip] >>>> On 16/12/02 18:38, in article 3DFE1D97.6020109@cogeco.ca, "Warren W.Gay >>>> VE3WWG" wrote: >>>>> >>>>> I would suggest one more small point WRT to: >>>>> >>>>> type day_name_type is (mon,tue,wed,thu,fri,sat,sun); >>>>> >>>>> Add a representation clause to guarantee that the values >>>>> start with sun => 0, mon => 1 etc. For some code, it is >>>>> much easier to work with the day of the week in the form >>>>> of a number. > Suppose you have an array of day_name_type that you want to > convert to an array of numbers. It's much cheaper to use > Unchecked_Conversion than it is to loop through the array and > call the 'Pos function or the 'Val function on each element of > the array. > Isn't mon => 0, ..., sun => 6 guaranteed to be the encoding of this type in any case, even without a representation clause? Defining sun => 0, mon => 1, inconsistently with 'Pos, is going to create a distributed inefficiency in processing this type. Can you see this being worth the hypothetical saving in unchecked array conversion? (We are discussing unconditional advice here.) -- Bill-Findlay chez blue-yonder.co.uk ("-" => "")