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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.202.178.70 with SMTP id b67mr9874647oif.70.1505290423374; Wed, 13 Sep 2017 01:13:43 -0700 (PDT) X-Received: by 10.36.80.78 with SMTP id m75mr101342itb.2.1505290422685; Wed, 13 Sep 2017 01:13:42 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!o200no723967itg.0!news-out.google.com!p6ni619itp.0!nntp.google.com!127no725064itw.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 13 Sep 2017 01:13:42 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.71.175.207; posting-account=uulyKwoAAAA86DO0ODu--rZtbje8Sytn NNTP-Posting-Host: 193.71.175.207 References: <9a6338d9-83be-4e45-b8b7-edc56e33537f@googlegroups.com> <2deb28e2-f7e8-4461-b8b8-c2c6cf2784aa@googlegroups.com> <5de470d2-aa3d-4c02-ae2b-266c33a289fe@googlegroups.com> <5126ef7a-3324-4e44-b110-5e4838189f5f@googlegroups.com> <3c76c2ed-319f-410c-8dec-6a80a0948c7a@googlegroups.com> <1c8a3a96-1cdb-4c16-9c25-2da9bbf52cc9@googlegroups.com> <4bebca5c-5044-457b-b623-9c79da90945f@googlegroups.com> <83bcc588-4762-47f5-9130-74faa7d9c25d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7958612a-2198-4257-8a76-7e2d913f1dad@googlegroups.com> Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language From: Egil H H Injection-Date: Wed, 13 Sep 2017 08:13:43 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 4277747493 X-Received-Bytes: 3568 Xref: news.eternal-september.org comp.lang.ada:48098 Date: 2017-09-13T01:13:42-07:00 List-Id: On Wednesday, September 13, 2017 at 9:24:56 AM UTC+2, Dmitry A. Kazakov wrote: > >> > >> X : String (1..1000); > >> Y : String (1..10); > >> > > > > You still can't do > > X := Y; > > Of course I can it is the same type. > Not without a Constraint_Error being raised... > > so why would you expect Bounded_String to behave that way? > > Because the contracts of ":=" of fixed- and variable-length strings are > different. > > Fixed-length string assignment cannot change length, as the type name > suggests. So the contract is that if the lengths are different > Constraint_Error is propagated. > Exactly my point... You can't just do X := Y when the ranges differ, and you can't just do X := Y for Bounded_Strings when they are of different types. > For bounded-length strings the contract is that the length may not > exceed the bound. So the contract is that Constraint_Error to propagate > only then. > Yes, and there are different types depending on the needs of the users. If they need a Name, they create a Bounded_String called Name with an upper bound. If they need an Address, they create a Bounded_String called Address with an upper bound that may or may not be different from the bound of Name. But you can't mix and match them willy-nilly, because they are of different types.