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.36.58.2 with SMTP id m2mr1387101itm.37.1505293224108; Wed, 13 Sep 2017 02:00:24 -0700 (PDT) X-Received: by 10.36.43.210 with SMTP id h201mr108914ita.7.1505293224078; Wed, 13 Sep 2017 02:00:24 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!127no741431itw.0!news-out.google.com!p6ni605itp.0!nntp.google.com!o200no740239itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 13 Sep 2017 02:00:23 -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> <7958612a-2198-4257-8a76-7e2d913f1dad@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <629a1a70-730e-4e16-9162-d7941f7a57a5@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 09:00:24 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 2440860920 X-Received-Bytes: 4645 Xref: news.eternal-september.org comp.lang.ada:48100 Date: 2017-09-13T02:00:23-07:00 List-Id: On Wednesday, September 13, 2017 at 10:57:50 AM UTC+2, Dmitry A. Kazakov wrote: > On 13/09/2017 10:13, Egil H H wrote: > > 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... > > Which is the desired effect. > > >>> 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... > > No, you said I cannot assign <=> it would be an illegal program. That is > wrong. I can. The program is legal, its behavior is defined. > > > You can't just do X := Y when the ranges differ, > > It is a legal Ada program. It compiles and works as expected. > > > and you can't just > > do X := Y for Bounded_Strings when they are of different types. > > This has nothing to do with strings being bounded or not. If an > operation is not defined on the given combination of types, then it is. > Calling undefined operations is an illegal program. > > >> 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. > > Non sequitur. The contract of bounded-length string assignment and user > needs for having types same or different are unrelated issues. > > There are plenty examples when the type is same but instances' > constraints are different. Ada's subtypes and discriminated types are > all about that. > > One can easily find examples for differently constrained instances of > bounded-length strings: > > Windows_Name : File_Name (MAX_PATH); > DOS_Name : File_Name (8 + 1 + 3); > > P.S. For further insights see the package Standard with Integer > *subtypes* Natural and Positive etc. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Now you're just grasping at straws.