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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8077d2e20cde67b1 X-Google-Attributes: gid103376,public From: niewiap@widzew.net (Pawe� Niewiadomski) Subject: Re: Modular types inside records Date: 2000/10/23 Message-ID: <8FD6C49EFPablo@213.25.200.9>#1/1 X-Deja-AN: 684885060 References: <8FD47616EPablo@213.25.200.9> <8ss7fb$5c7$1@nnrp1.deja.com> <8FD4BD4F4Pablo@213.25.200.9> X-Complaints-To: usenet@tpi.pl X-Trace: news.tpi.pl 972321728 7322 195.117.215.73 (23 Oct 2000 17:22:08 GMT) Organization: tp.internet - http://www.tpi.pl User-Agent: Xnews/03.04.11 NNTP-Posting-Date: 23 Oct 2000 17:22:08 GMT Newsgroups: comp.lang.ada Date: 2000-10-23T17:22:08+00:00 List-Id: bobduff@world.std.com (Robert A Duff) wrote in : > >It can be made to work. > >But I don't think this is a good use of modular types. Instead, use a >normal (signed) integer type ("range 0..Whatever"), and use an explicit >"mod" operation, or an explicit if statement. That makes the code more >readable, by making it clear what's going on at the "wraparound" place. > >- Bob > I don't think that adding a couple of if statements makes the code more readable. On the contrary: if someone looks at the record and sees a modular type, he says: OK, so I don't have to worry about constraint errors; I can get down to the important stuff. My implementations of the empty and full functions are just one-line-long and add and remove procedures each take up as much as five lines of code. Imagine what they would look like if you had to check for constraint errors every time. The package body would be much less readable than it is now. I don't like explicit programming too much, anyways. I guess I am too much of a C++-type simplicity addict. Pawel