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,a0be06fbc0dd71f1 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newshub.sdsu.edu!newscon04.news.prodigy.net!prodigy.net!newsfeed.telusplanet.net!newsfeed2.telusplanet.net!newsfeed.telus.net!edtnps90.POSTED!53ab2750!not-for-mail Sender: blaak@METROID Newsgroups: comp.lang.ada Subject: Re: The future of Ada is at risk References: <20071229040639.f753f982.coolzone@it.dk> <13oe680qard6u2d@corp.supernews.com> <47887709.9030107@obry.net> <47889568.3010507@obry.net> <4789038F.7090708@obry.net> <1200176645.8909.4.camel@K72> From: Ray Blaak Message-ID: Organization: The Transcend User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 14 Jan 2008 01:46:18 GMT NNTP-Posting-Host: 154.20.94.243 X-Trace: edtnps90 1200275178 154.20.94.243 (Sun, 13 Jan 2008 18:46:18 MST) NNTP-Posting-Date: Sun, 13 Jan 2008 18:46:18 MST Xref: g2news1.google.com comp.lang.ada:19396 Date: 2008-01-14T01:46:18+00:00 List-Id: "(see below)" writes: > On 13/1/08 03:54, in article ulk6uxtw7.fsf@STRIPCAPStelus.net, "Ray Blaak" > wrote: > > In fact, since I have left the Ada camp, I have never felt the need to > > have a constrained integer type (well, beyond Positive or Natural). I have > > however, felt the need to have the compiler prevent accidental mixups > > between a "count of widgets" and a "count of wingbats". > > Selecting just the integer ranges from some of my code, > and ignoring the float, character, and enumeration ranges, > I find the following: > > subtype a_logger_list_size is Natural range 0..max_logger_list_size; > subtype a_positive_unsigned is an_unsigned range 1 .. an_unsigned'Last; [...] > I assert that, in context, these are the natural and > necessary ways to achieve my software engineering objectives. > You'll have to trust me on that. 8-) In Ada, sure. I did this instinctively myself. My feeling now is that these upper bounds are artificial and self imposed. What does it mean to have a maximum amount of log messages, for example? Design your software so that it doesn't care. Finite but unbounded is usually a better maximum. Lower bounds probably matter more. Perhaps in very controlled or embedded situations where resources are tight, constrained ranges make sense. And when such ranges are very small (which tends to mean each integer value has a distinct meaning_ probably using an enumeration as an index is better (I do miss that, actually). -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.