From: niewiap@widzew.net (Pawe� Niewiadomski)
Subject: Re: Modular types inside records
Date: 2000/10/23
Date: 2000-10-23T17:22:08+00:00 [thread overview]
Message-ID: <8FD6C49EFPablo@213.25.200.9> (raw)
In-Reply-To: wccd7gr385o.fsf@world.std.com
bobduff@world.std.com (Robert A Duff) wrote in
<wccd7gr385o.fsf@world.std.com>:
>
>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
next prev parent reply other threads:[~2000-10-23 0:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-21 0:00 Modular types inside records Pawe� Niewiadomski
2000-10-21 0:00 ` Robert Dewar
2000-10-21 0:00 ` Pawe� Niewiadomski
2000-10-21 0:00 ` Jeff Carter
2000-10-21 0:00 ` Pawe� Niewiadomski
2000-10-23 0:00 ` Robert A Duff
2000-10-23 0:00 ` Pawe� Niewiadomski [this message]
2000-10-24 0:00 ` Robert A Duff
2000-10-25 1:50 ` Nick Roberts
2000-10-25 0:00 ` Pawe� Niewiadomski
2000-10-27 22:05 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox