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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a3157e5254b8223 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d77g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Array slices and types Date: Thu, 21 Aug 2008 14:16:20 -0700 (PDT) Organization: http://groups.google.com Message-ID: <48b63de7-5990-4612-8129-83d9262587f4@d77g2000hsb.googlegroups.com> References: <5886ab95-8744-4b72-b911-e4cb8889c7e7@d1g2000hsg.googlegroups.com> <1eb141ff-82f8-4969-a525-5e931419d631@1g2000pre.googlegroups.com> NNTP-Posting-Host: 85.3.252.233 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1219353380 26427 127.0.0.1 (21 Aug 2008 21:16:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 21 Aug 2008 21:16:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d77g2000hsb.googlegroups.com; posting-host=85.3.252.233; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7470 Date: 2008-08-21T14:16:20-07:00 List-Id: On 20 Sie, 22:45, Adam Beneschan wrote: > Do you really need a new *type*, as opposed to: > > =A0 =A0subtype Name is String (1 .. 10); > > ??? Good question. If I make it a subtype, then I have no protection against mixing First_Name with Device_Name with File_Name with Signal_Name with Any_Other_Name - and that would defeat the whole purpose of defining them. Consider: declare subtype First_Name is String (1 .. 4); subtype Device_Name is String (1 .. 4); Someone : First_Name :=3D "Adam"; Something : Device_Name :=3D "usb1"; begin Someone :=3D Something; -- oops end; That's why I was thinking about distinct types. I'm OK with type casts when assigning them from regular String. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada