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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d5b211b0c1ffcf3e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.152.217 with SMTP id h25mr2963885bkw.3.1339364218125; Sun, 10 Jun 2012 14:36:58 -0700 (PDT) MIME-Version: 1.0 Path: e27ni36274bkw.0!nntp.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.alt.net!news.dizum.com!sewer-output!mail2news From: Nomen Nescio Newsgroups: comp.lang.ada Subject: Re: Practicalities of Ada for app development References: <1c82b5mc3waww.1t6q6vj61u36u.dlg@40tude.net> Message-ID: <42a87cf3ce9bfd6054f78b2b5b356301@dizum.com> Date: Sun, 10 Jun 2012 23:36:46 +0200 (CEST) Mail-To-News-Contact: abuse@dizum.com Organization: mail2news@dizum.com X-Received-Bytes: 1327 Date: 2012-06-10T23:36:46+02:00 List-Id: "Dmitry A. Kazakov" wrote: > > > Please, why have you defined Code_Point as a modular type? > > Because code point is unsigned. When you declare something signed > you do that because you want negative inverses. Signed integers have > the base type with 0 in the middle of its range. That's no reason to use mod. You can put boundaries where you want them, integer, or mod. It's about the operators. Mod affects the arithmetic. If you want my_type'last + 1 to equal my_type'first, then mod is appropriate. If you want the Ada runtime to bitch when you do that, then a unsigned non-modular discrete type is appropriate. Choosing a modular type in a case where it doesn't make sense to have modular arithmetic operators is an abuse of the language.