comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Modular types inside records
Date: 2000/10/23
Date: 2000-10-23T00:00:00+00:00	[thread overview]
Message-ID: <wccd7gr385o.fsf@world.std.com> (raw)
In-Reply-To: 8FD4BD4F4Pablo@213.25.200.9

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

niewiap@widzew.net (Pawe� Niewiadomski) writes:

> Pretty neat, huh?  Not as flexible as my previous (erroneous) idea (you 
> need to instantiate the generic every time you want to change the size of 
> your queue), but still gets rid of constraint verification problem.  It is 
> just a rough, untested idea, but I think it will work.

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




  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 [this message]
2000-10-23  0:00       ` Pawe� Niewiadomski
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