comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Visibility of Indexing aspects
Date: Fri, 27 Jul 2018 16:58:26 -0500
Date: 2018-07-27T16:58:26-05:00	[thread overview]
Message-ID: <pjg4i2$tng$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: f923e960-d3de-4f65-91c6-bbf0a898d2f8@googlegroups.com

"Shark8" <onewingedshark@gmail.com> 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.


  parent reply	other threads:[~2018-07-27 21:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-14 14:18 Visibility of Indexing aspects Jere
2018-07-14 17:04 ` Shark8
2018-07-14 18:29   ` Jere
2018-07-14 18:41     ` Dmitry A. Kazakov
2018-07-14 23:00     ` Shark8
2018-07-14 23:28       ` Jere
2018-07-15 14:41 ` AdaMagica
2018-07-15 15:33   ` Jere
2018-07-16  3:22     ` AdaMagica
2018-07-17  0:35       ` Jere
2018-07-17  9:46         ` AdaMagica
2018-07-17 10:11           ` AdaMagica
2018-07-20 12:08             ` Jere
2018-07-20 16:11               ` AdaMagica
2018-07-20 22:03                 ` Dan'l Miller
2018-07-20 22:07                 ` Jere
2018-07-21 10:33                   ` AdaMagica
2018-07-24  3:32                   ` Randy Brukardt
2018-07-24 17:15                     ` Dan'l Miller
2018-07-25  5:37                       ` Randy Brukardt
2018-07-25 18:26                         ` Dan'l Miller
2018-07-25 19:58                           ` AdaMagica
2018-07-25 20:57                             ` Dan'l Miller
2018-07-26  0:12                               ` Randy Brukardt
2018-07-26  2:41                                 ` Dan'l Miller
2018-07-26 19:09                                   ` Randy Brukardt
2018-07-26 20:31                                 ` Shark8
2018-07-26 21:25                                   ` Dan'l Miller
2018-07-27 22:05                                     ` Randy Brukardt
2018-07-28  0:35                                       ` Dan'l Miller
2018-07-27 21:58                                   ` Randy Brukardt [this message]
2018-07-20 22:23                 ` Jere
2018-07-20 22:25                   ` Jere
2018-07-21  5:58                   ` J-P. Rosen
  -- strict thread matches above, loose matches on Subject: below --
2018-08-02 20:31 Randy Brukardt
2018-08-03  0:43 ` Dan'l Miller
2018-08-03 20:56   ` Randy Brukardt
2018-08-03 21:32     ` Dan'l Miller
2018-08-06 21:46       ` Randy Brukardt
2018-08-06 22:12         ` Dmitry A. Kazakov
2018-08-07 15:13         ` Dan'l Miller
2018-08-07 22:41           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox