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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.36.112.200 with SMTP id f191mr10426290itc.55.1519694955535; Mon, 26 Feb 2018 17:29:15 -0800 (PST) X-Received: by 10.157.46.5 with SMTP id q5mr563080otb.10.1519694955288; Mon, 26 Feb 2018 17:29:15 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no41277ita.0!news-out.google.com!a2ni19ite.0!nntp.google.com!w142no41272ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 26 Feb 2018 17:29:15 -0800 (PST) In-Reply-To: <62f83fe5-15d6-41cf-952f-bc3cb077d42f@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.241.61.1; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.241.61.1 References: <62f83fe5-15d6-41cf-952f-bc3cb077d42f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <473f9b1a-6466-4745-9041-107f54062cf2@googlegroups.com> Subject: Re: [Newbie] doubly constrained array, dumb question From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Tue, 27 Feb 2018 01:29:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 3095297581 X-Received-Bytes: 3432 Xref: reader02.eternal-september.org comp.lang.ada:50675 Date: 2018-02-26T17:29:15-08:00 List-Id: > Dmitry said: > 1. array's index > 2. array's element > 3. record's component > 4. access type's target type > 5. discriminant > 6. argument of a subroutine access type > 7. class-wide types (closed range of descendants T'Class (T..S)) > 8. tagged type primitive operations (disallowing operations) > 9. protected and task type entries (disallowing operations) > 10. task type entry family Oh, I also arrived at that conclusion for the first five + seventh, I didn'= t imagine the sixth but there's no reason one shouldn't be able to do that. For 8: a class has any sense at all only if there's no dispatching to an in= existent method, and your forbidding some methods would do the same, raise = an exception. So to avoid that, if you want to disallow operations (without make a dispat= ching call to it raises an exception), you have to cut the tagged type from= its root, by hiding the fact it has a parent type, so as to disinherit the= parent's method. If you don't want that, (I suppose) one would have to implement a per-opera= tion basis dispatching mechanism with a list of allowed types for each meth= ods ? I don't know enough protected types or task types, but I think you can hide= protected operations/entry types as easily, I suppose you can hide the typ= e's progenitors too. Too bad I'm in the middle of writing a line editor (Ad= aTutor assignement 5), I can't test that. Could you give an example of 10, the syntax you would like ? ... I wanted to have an anonymous string subtype in a record. Shouldn't hav= e been terribly important. I made without, but had to add a discriminant Le= ngth, which is idiotic since the only use for my record type is to be alloc= ated dynamically, and the string field would always be initialized. In that= case I wouldn't risk anything by having type LINK is record Next: access LINK; TEXT:String; end record; being legal. ... since all use would be like this: some_access_to_link :=3D new (Next_li= nk, new STRING(TEXT_INPUT)), and TEXT_INPUT would carry its Length informat= ion with it and the object would always have a fixed length.