comp.lang.ada
 help / color / mirror / Atom feed
From: bglbv@my-dejanews.com
Subject: Re: Modular type. What is it and why?
Date: 1999/04/06
Date: 1999-04-06T23:39:44+00:00	[thread overview]
Message-ID: <871zhxmlaw.fsf@bglbv.my-dejanews.com> (raw)
In-Reply-To: 7edk6p$1j7$1@its.hooked.net

"Mike Silva" <mjsilva@jps.net> writes:

> As Ole-Hjalmar Kristensen commented, the nice Ada solution doesn't work if
> NUM_ELEMENTS varies at runtime (at least, it appears that a modular type
> can't be defined dynamically -- correct?), but that's not the usual case I
> run across.

Correct: the standard requires the modulus to be a *static* expression.
There is a similar restriction for signed integer types (and fixed and
floating point types): presumably it would be too much trouble to have
to choose between, say, a 16-bit and a 64-bit representation at run time.
Subtypes, on the other hand, can have their constraints elaborated at
run time, but that doesn't let one change the modulus...




  reply	other threads:[~1999-04-06  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-05  0:00 Modular type. What is it and why? Staffan Dittmer
1999-04-05  0:00 ` Marin David Condic
1999-04-05  0:00 ` David C. Hoos, Sr.
1999-04-06  0:00   ` Mike Silva
1999-04-06  0:00     ` Ole-Hjalmar Kristensen
1999-04-06  0:00     ` Marin David Condic
1999-04-06  0:00       ` Mike Silva
1999-04-06  0:00         ` bglbv [this message]
1999-04-07  0:00         ` Ole-Hjalmar Kristensen
1999-04-07  0:00           ` Mike Silva
1999-04-07  0:00             ` Stephen Leake
1999-04-08  0:00             ` Ole-Hjalmar Kristensen
1999-04-06  0:00     ` Mike Silva
1999-04-07  0:00       ` Robert Dewar
1999-04-07  0:00         ` Bret
1999-04-11  0:00         ` Florian Weimer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox