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: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Indefinite Containers of Indefinite Private Types Date: Tue, 4 Aug 2015 11:56:24 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 4 Aug 2015 18:54:50 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="5015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3eM4Z8RCZeBLSYGwP0w4oBT7lKJuRgtI=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: X-Mozilla-News-Host: news://freenews.netfront.net Cancel-Lock: sha1:GlsL/BSpIEChkHD6l8ZQNHAJ+iA= Xref: number.nntp.giganews.com comp.lang.ada:194660 Date: 2015-08-04T11:56:24-07:00 List-Id: On 08/03/2015 10:40 PM, Niklas Holsti wrote: > > I'm not sure that I have understood your question correctly -- are you asking > for the RM rule that makes this illegal, or for the reason behind that rule? Sorry if I was unclear. I know the ARM prohibits using an uncompleted private type as the actual for a generic formal. I'm wondering why this applies to the case of a generic formal indefinite private type. Reading that leads me to think that I should have used a subject referring to generic formal indefinite private types rather than indefinite containers. > At the point of instantiation in the second case, "T" is a partial view of the > type. RM 7.3(5) says "... Similarly, before the full declaration, the name of > the partial view cannot be used in a generic_instantiation or in a > representation item." Right. This rule has the advantage of being simple. It seems to me it may have the disadvantage of disallowing feasible instantiations. > As to why this rule exists, I suspect it has to do with the "rechecks" discussed > in the annotated RM 12.3(11) where the legality of an instantiation is checked > by comparing the actual types with the _full_ declaration of the generic (not > only with the declarations of the generic formals). It might be difficult to > apply these rechecks if the actual type is only a partial view. What a generic can do with a formal indefinite private type is quite limited. Nothing it can do seems to me to need to know the full type definition. Maybe I've overlooked something, or maybe there's a good reason why something I don't think needs the full definition actually does. I'm curious whether such instantiations could be legal, and what I missed if they can't. > The second case becomes legal if the full declaration of type T is moved to > occur before the instantiation -- as happens in the first case -- but you > probably knew that. Yes, of course. The examples are simplified from a more complex case where the container is used in the full type definition. This can be achieved by adding some additional code that is essentially noise, or by using access types. Avoiding access types is worth adding noise, but it would be nice if the noise were unnecessary. -- Jeff Carter "Have you gone berserk? Can't you see that that man is a ni?" Blazing Saddles 38