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=-0.3 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fcf8ea94b94d6941 X-Google-Attributes: gid103376,public From: bglbv@my-dejanews.com Subject: Re: Modular type. What is it and why? Date: 1999/04/06 Message-ID: <871zhxmlaw.fsf@bglbv.my-dejanews.com>#1/1 X-Deja-AN: 463406715 References: <7ean3c$79m$1@eol.dd.chalmers.se> <7eb2iq$jc3@hobbes.crc.com> <7ede2p$pd1$1@its.hooked.net> <370A4B3A.5EDB3B37@pwfl.com> <7edk6p$1j7$1@its.hooked.net> X-Complaints-To: abuse@theplanet.net X-Trace: news4.svr.pol.co.uk 923441984 5697 62.136.95.129 (6 Apr 1999 23:39:44 GMT) Organization: Customer of Planet Online NNTP-Posting-Date: 6 Apr 1999 23:39:44 GMT Newsgroups: comp.lang.ada Date: 1999-04-06T23:39:44+00:00 List-Id: "Mike Silva" 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...