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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Visibility of Indexing aspects Date: Fri, 27 Jul 2018 16:58:26 -0500 Organization: JSA Research & Innovation Message-ID: References: <40d568da-4715-42de-8e28-98da39a5c974@googlegroups.com> <34f499f7-020f-4dcc-adad-0ab1113386d1@googlegroups.com> <9d69e7b5-6b2d-4607-9f7b-affa78c41620@googlegroups.com> <41c711cb-0300-4a41-93d3-e69297ae1945@googlegroups.com> <42de4aa3-9e7c-44b8-aa84-712cc7ce03c6@googlegroups.com> <9b6b6f10-5956-4a19-83f5-c1c015c62602@googlegroups.com> <8720f70a-59b1-4297-b2fc-78804ec88b7b@googlegroups.com> <756cb66b-1ef8-4d9e-b679-118b6c59e89c@googlegroups.com> <1392b483-af72-4dbe-ad51-bd703405b7a8@googlegroups.com> <3eebe2fb-f066-4248-9b2f-1db32497fd82@googlegroups.com> Injection-Date: Fri, 27 Jul 2018 21:58:27 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="30448"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:53991 Date: 2018-07-27T16:58:26-05:00 List-Id: "Shark8" wrote in message news:f923e960-d3de-4f65-91c6-bbf0a898d2f8@googlegroups.com... > On Wednesday, July 25, 2018 at 6:12:24 PM UTC-6, Randy Brukardt wrote: ... >> Sounds like babble to me. What's used by the client has to be public, >> period. > > But this is legal: > > Package K is > Type Example is private; > Private > Type Example is null record; > For Example'Size use 4; > End K; > > Package J is > Type Hex is range 16#0#..16#F# > with Size => 4; > > Type Ex_2 is record > Item_1 : Hex; > Item_2 : K.Example; > end record > with Size => 8; > > End J; Yes, and that's a significant bug in Ada. Ada excepts representational things from privacy rules, and that causes a variety of problems. I would argue that if you want to explictly use the size of something, then it needs to have been specified visibly. But like seemingly everything, that's too incompatible to do now. ... > But that's not the issue that is being cited in the original post. Surely: but it was one of the issues that Dan'l was writing a novel about. > The issue is that all the indexing-attributes are declared/used in the > private part and are [apparently] being used in the publicly visible part. > > Is this correct? > Arguments could be made in either direction: > (for-allowing) This allows the public declaration to be kept clean of > generally non-relevant details; much like declaring stream input/output > functions needn't be made explicitly public to work (due to the stream > attributes being accessable). Surely, but the availability of the core operation is even more important. Stream attributes work much like overriding; the actual body called is determined by the definition in the private part, but there always is a body (whether something is defined in the private part or not). More generally, that model works for any operation that is *visibly* available. Stream attributes, inherited subprograms, etc. It doesn't work for operations which are being defined for the first time and aren't available by default (iteration, indexing, hopefully literals, etc.) One could imagine having an extra declaration that some indexing is going to be provided in the private part. That would be pretty messy (since the type of the index(s) would have to be provided along with existence of the operation) but it could be done. We just didn't see any reason to bother with doing it, since typically one wants to be able to use the long-hand form (that is, the explicit function calls) in some cases. (You might not want to actually retrieve the element, for instance.) > (for-disallowing) The indexable interface may not be intended for use > outside of >the PRIVATE visibility space (BODY, children's private, children's body). Correct; you want to be able to have the ability to define such things only for private use. Randy.