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,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news-xfer.newsread.com!nntp.abs.net!rcn!feed3.news.rcn.net!not-for-mail Sender: jsa@rigel.goldenthreadtech.com Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> <87eklg62x8.fsf@news.bourguet.org> <782e906e.0409082138.20369fc8@posting.google.com> From: jayessay Organization: Tangible Date: 09 Sep 2004 21:04:52 -0400 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: DXC==^0WPfP>0@eo?iRBY^D> chad.rmeiners@gmail.com (Chad R. Meiners) writes: > "jayessay" wrote in message > news:m3acw0bl1u.fsf@rigel.goldenthreadtech.com... > > with Text_Io; use Text_Io; > > > > procedure Foo is > > > > type Hex_Num is mod 16; > > > > function Hext (N : Integer) return Hex_Num is > > begin > > -- == (1+ (n mod 16)), which is the logic error. > > return Hex_Num(1 + (N mod Hex_Num'Modulus)); > > end Hext; > > However, most Ada programmers would have written it like > > procedure Foo is > type Hex_Num is mod 16; > > function To_Hex_Num(Item : Integer) return Hex_Num is > begin -- This function provides the correct conversion > -- for use by all other subroutines. > return Hex_Num(Item mod Hex_Num'Modulus); > end To_Hex_Num; > > function Hext (N : Integer) return Hex_Num is > begin > return 1 + To_Hex_Num(N); -- Note To_Hex_Num(1+N) also works > end Hext; > > ... > > and avoided the problem altogether. All you are saying is that _the programmer_ would have caught the logic error! In this ridiculously simple case, sure. The Lisp programmer would never have brain farted like this in this simple case either!! The point is, the programmer in this case, Georg Bauhaus, _did_ make the error and did not avoid the problem! /Jon -- 'j' - a n t h o n y at romeo/charley/november com