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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,ac4955b8006bd13c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.68.196.232 with SMTP id ip8mr10205351pbc.6.1338806195987; Mon, 04 Jun 2012 03:36:35 -0700 (PDT) Path: l9ni19127pbj.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Q: type ... is new String Date: Mon, 04 Jun 2012 12:35:21 +0200 Organization: A noiseless patient Spider Message-ID: References: <336f4e4b-16da-4fa8-9b7a-7e2dd3a48018@w24g2000vby.googlegroups.com> Mime-Version: 1.0 Injection-Date: Mon, 4 Jun 2012 10:35:19 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="UreEQGySgsZhJTdb4MFt/A"; logging-data="25676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VGfmrePcVRiX0u4Tx3cHW" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Cancel-Lock: sha1:Pg9KUlPt3ZDfXRtgxcB+6FkgN1A= X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-06-04T12:35:21+02:00 List-Id: Le 04/06/2012 09:48, Yannick DuchĂȘne (Hibou57) a Ă©crit : > Good idea. I did not consider this one, may be due to the natural > tendency of deriving from an already existing type with similar meaning. Which is very common, and to my taste, not a good idea. One of the unique features of Ada is the ability to define your own types that match your needs from scratch, without hooking them to some predefined "magical" types with special properties, as happens in most other languages. Integer is an integer type like any other, String is an array type like any other, etc. No reason to derive from them, but there are good reasons not to. For example, if you define: type Int is new Integer range 1..10; you inherit (by default) the representation of Integer, presumably 32 bits. And you can't define this way a type /wider/ than integer. If you write: type Int is range 1..10; the compiler chooses the most efficient implementation, and there is not limit other than the capabilities of the machine. -- 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