comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: Visibility of Indexing aspects
Date: Tue, 24 Jul 2018 10:15:03 -0700 (PDT)
Date: 2018-07-24T10:15:03-07:00	[thread overview]
Message-ID: <8720f70a-59b1-4297-b2fc-78804ec88b7b@googlegroups.com> (raw)
In-Reply-To: <pj66jj$cse$1@franka.jacob-sparre.dk>

On Monday, July 23, 2018 at 10:32:04 PM UTC-5, Randy Brukardt wrote:
> "Jere" wrote in message 
> news:dbc94806-dbf9-408d-b8ad-3a159eb85b24@googlegroups.com...
> ...
> > Question:  Section 13.1.3 (1/3) says "The declaration with
> > the aspect_specification is termed the associated declaration."
> > In the case of the bugged example I gave, the aspect_specification
> > was with the full view of the type.  Is that then considered the
> > declaration of the type, or is just the partial view in the public
> > section considered the declaration?  I am assuming the full view
> > is still considered the declaration.
> 
> They're two separate-but-related declarations. You can tell if something is 
> a declaration by looking at the name of its syntax. If the syntax includes 
> "_declaration",  then it's a declaration. And since we have 
> private_type_declaration and full_type_declaration, they're both 
> declarations. (See RM 3.1 for the more formal definitions.)
> 
> There are implicit declarations as well, of course, but they don't have 
> anything to do with this particular question.

But where is “associated” (as quoted from the _LRM_) defined as clearly not meaning “related” (as quoted from Randy's reply)?

AdaMagica overtly claims (and Randy less directly seems to affirm) that only the private declaration of Container is “associated” in the _LRM_.  Conversely, Randy directly claims that the public declaration of Container is “related” (but presumably not “associated”).  Unless these “associated” and “related” terms are given definitions overtly in the _LRM_ (or at least illuminating-color commentary in the _AARM_), then relying the commonfolk English dictionary definitions of “associated” and “related” do not give definitions that definitively say that the public declaration of Container is “related” but not “associated” to the private declaration of Container.  (This is what I mean a few replies ago about ‘sloppy definitions’.)

And if this ambiguity (that clearly AdaCore interpreted differently than via this thread's logic) is resolved by making the OP's code illegal, then what would be the adjustment to the OP's code to attain that intended & evoked feature (that would be otherwise removed)?  Would this be the replacement to keep the Reference et. al. private?
with Ada.Text_IO; use Ada.Text_IO; 
with Ada.Text_IO; use Ada.Text_IO; 

procedure jdoodle is 
    package Containers is 

      type Container is private
        with Variable_Indexing => Reference;
OR
      type Container is private record
        with Variable_Indexing => Reference;
OR
      type Container is private tagged record
        with Variable_Indexing => Reference;
      
    private 

      type Container_Array is array(1..20) of aliased Integer; 
      type Container is tagged record 
         Data : Container_Array := (others => 0); 
      end record;
      
      type Reference_Holder 
         (Element : not null access Integer) 
      is limited null record 
         with Implicit_Dereference => Element; 
      
      function Reference 
         (Self  : aliased in out Container; 
          Index : Positive) 
          return Reference_Holder 
      is (Element => Self.Data(Index)'Access); 
      
    end Containers; 
    
    C : aliased Containers.Container; 
begin 
    for Index in 1 .. 20 loop 
        C(Index) := Index; 
        Put_Line(Integer'Image(C(Index))); 
    end loop; 
end jdoodle;


  reply	other threads:[~2018-07-24 17:15 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 [this message]
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
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