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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: gnat.string_split , howto manipulate slice numbers Date: Tue, 29 Oct 2019 19:33:08 +0100 Organization: Adalog Message-ID: References: <5d710dac-d172-4a31-899e-1bf95e220ed6@googlegroups.com> <7fb6d1d0-18df-43b9-bcdc-9782dfb5171c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 29 Oct 2019 18:33:08 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="73aadb64af1985d5c6b73196267cdc01"; logging-data="25303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193yRgKk6WpV2eM5L/340wn" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cancel-Lock: sha1:hGpF3HhxfpxI5CS822VGilAZdbM= In-Reply-To: Content-Language: fr Openpgp: preference=signencrypt Xref: reader01.eternal-september.org comp.lang.ada:57378 Date: 2019-10-29T19:33:08+01:00 List-Id: Le 29/10/2019 à 17:47, Simon Wright a écrit : > type Slice_Number is new Natural; > > For me, this carries declaring a type rather than a subtype further than > necessary. A subtype? Or why not just use Natural? Integer (or its subtypes) should be avoided in general. It is non portable, and carries no information to the reader about the purpose of the type. Making appropriate types that cannot be mixed is key to the philosophy of Ada ("strong typing", you know...). Of course, defining proper bounds is better than deriving from Integer, but in reusable components, you don't always have enough context to determine absolute bounds, so you have to rely on a "reasonable" integer type like Integer. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr