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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: ADA.STRINGS.INDEX_ERROR : a-strunb.adb:782 Date: Sat, 20 Jan 2018 10:47:19 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <7e895632-e0f9-4035-a0a3-1a31a262c8b3@googlegroups.com> <6e4679ff-6058-40ec-821a-791507313906@googlegroups.com> NNTP-Posting-Host: f8WEMHpTPFsoaovNG/8BOQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:50018 Date: 2018-01-20T10:47:19+01:00 List-Id: On 2018-01-20 01:42, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:p3sbkb$1msl$1@gioia.aioe.org... >> On 19/01/2018 02:10, Randy Brukardt wrote: > ... >>> The benefit is that these things can express ideas that aren't possible >>> for >>> ordinary subprogram calls. >> >> That does not justify special syntax. E.g. initialization cannot be >> expressed as a subprogram call either, nevertheless there is no special >> syntax for declaration of objects with non-null initialization. > > ??? ":=" is the special syntax of initialization (it's not the syntax of a > subprogram call!). Your example seems to prove my point. :-) I meant rather this: type T is new Ada.Finalization.Controlled with ... X : T; Y : Integer; >>> To express Subtype'First as a function, one would >>> have to have some sort of meta-type (a subtype parameter). >> >> I don't think this is related. >> >> (However I am glad that you begin to see subtypes as proper types. (:-)) > > A type parameter clearly would have to pass the subtype information as well, Yes, like it does with array bounds, *if* it were a subprogram proper. This is irrelevant because it is not a subprogram, it only has a syntax of a subprogram call. But for the compiler it is a special case exactly like it is when the attribute syntax is used, or any other syntax. The detection does not require special syntax, that is the point. Once the compiler detects the case, the magic starts to work. > since Ada does not allow naming of types. In this case, it is the subtype > information that is most relevant. So I don't see your point or joke. It was frequently argued that subtypes are not types but something, well, something... > (And I > don't see why you don't think it is related, either. One has to have some > mechanism for getting this information, and if you eliminate the special > mechanism for that, some replacement is needed. In the proposed language, > only a subprogram call is available, unless some other special syntax is > invented, which is just kicking the can.) It is the same mechanism used to pass/eliminate array bounds. It could be generalized for all types including non-tagged classes. The type tag of a non-tagged type is a [sub]type constraint to be passed or not. The same case is represented by dimensioned values. The dimension is a constraint, again passed or not down to the subprogram, kept or not in an instance. I think it is possible to design common rules for all this and make the language quite simple. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de