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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7d533acec91ae16 X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Question for the folks who designed Ada95 Date: 1999/04/29 Message-ID: <3728D556.24DF23D4@pwfl.com>#1/1 X-Deja-AN: 472482896 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <7g2qu4$ca4$1@usenet.rational.com> <7g6urm$v5r$1@nnrp1.dejanews.com> <3727EA10.34D0AB3B@rocketmail.com> <7g9r4i$gn2$1@nnrp1.dejanews.com> <925401850.901.27@news.remarQ.com> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada Date: 1999-04-29T00:00:00+00:00 List-Id: Fraser Wilson wrote: > > I'm torn. On the one hand, restricting modular types to powers of 2 would > have been an arbitrary-looking quite un-Ada-like restriction. On the > other, modular types which aren't a power of 2 cause an astonishingly > low gain to pain ratio. > > Were it not for the non-power-of-2 modular types, I can't see that > Shift_Left and Shift_Right attributes would be difficult to justify. > > Fraser. > (trying and failing to think of a good syntax for a modular type > the expresses only the power of 2 that forms the modulus ... hmmmm) I like the notion of creating two different classes similar to Fixed and Decimal types - giving you a choice of underlying implementation. You could have "Modular" types which are restricted to powers of 2 and "Wraparound" types which have no restrictions: type My_Type is wrap 234..567 ; That lets someone slide the wraparound semantics anywhere that is useful to them and would probably make compilation simpler because of never having to detect special cases. Of course, now that Modular types are defined without restrictions to powers of two, its impossible to ever get the situation reversed. Too many programs will have some dependency on non-powers-of-2 so future compilers will have to support it. No sense inventing a new class at that point... MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 ***To reply, remove "bogon" from the domain name.*** Visit my web page at: http://www.flipag.net/mcondic