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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ac4955b8006bd13c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.223.40 with SMTP id qr8mr9874465pbc.0.1338796089232; Mon, 04 Jun 2012 00:48:09 -0700 (PDT) Path: l9ni18315pbj.0!nntp.google.com!news2.google.com!feed-C.news.volia.net!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Q: type ... is new String Date: Mon, 04 Jun 2012 09:48:07 +0200 Organization: Ada @ Home Message-ID: References: <336f4e4b-16da-4fa8-9b7a-7e2dd3a48018@w24g2000vby.googlegroups.com> NNTP-Posting-Host: Dd9R6puHiTvzf2FllTJGfQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.00 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-06-04T09:48:07+02:00 List-Id: Le Mon, 04 Jun 2012 08:30:14 +0200, J-P. Rosen a =C3=A9= crit: > Le 04/06/2012 07:58, Yannick Duch=C3=AAne (Hibou57) a =C3=A9crit : >> Minimum_Length : constant :=3D ; >> Maximum_Length : constant :=3D ; >> >> subtype Index_Type is Natural range Minimum_Length .. Maximum_Leng= th; >> >> type Path_Type is new String (Index_Type); >> -- Unfortunately, this freeze the lower and upper bound, and the >> -- declaration below fails. >> >> XYZ_Location : Path_Type :=3D "..................."; -- Will fail.= > Why not: > type Path_Type is array (Index_Type range <>) of Character; > > ? > Reminder: There is nothing special to type String, you'll still have > literals etc. Good idea. I did not consider this one, may be due to the natural tenden= cy = of deriving from an already existing type with similar meaning. While I'm OK with this idea and feel it good, I would not apply it, = because I would prefer to derive from String. Ada lacks a way to narrow = = the allowed range of a derived array type. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity