comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Assignment access type with discriminants
Date: Thu, 23 Mar 2023 20:53:02 +0100	[thread overview]
Message-ID: <tviams$19ejf$1@dont-email.me> (raw)
In-Reply-To: <k83llkF8ubmU2@mid.individual.net>

On 2023-03-23 19:55, Niklas Holsti wrote:

> Perhaps it would be better to make the assignment P := PF2.all'Access 
> illegal, because it in effect converts a constrained access value (PF2) 
> to an unconstrained access subtype (P), and so in some sense violates 
> the prohibition of constrained subtypes of general access types.

Yes this is substitutability violation. Such cases never go without a 
punishment. In this case it is an implementation overhead.

Consider:

   procedure Set (Destination : in out Foo; Source : Foo) is
   begin
      Destination := Source;
   end Set;

The compiler cannot implement Set in a natural way, because Destination 
might be arbitrarily constrained by the caller. E.g. when the actual for 
Destination is P.all. So, the constraint must be passed together with 
the actual. A quite burden.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2023-03-23 19:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  9:19 Assignment access type with discriminants Dmitry A. Kazakov
2023-03-22  9:31 ` Björn Lundin
2023-03-22 14:10 ` G.B.
2023-03-23 11:51   ` Dmitry A. Kazakov
2023-03-23 16:53     ` AdaMagica
2023-03-23 18:09       ` Niklas Holsti
2023-03-23 17:04 ` J-P. Rosen
2023-03-23 18:55   ` Niklas Holsti
2023-03-23 19:53     ` Dmitry A. Kazakov [this message]
2023-03-24  9:41     ` J-P. Rosen
2023-03-25  8:51       ` 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