comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Question regarding example code in AI12-0140
Date: Fri, 7 Nov 2014 21:58:30 -0600
Date: 2014-11-07T21:58:30-06:00	[thread overview]
Message-ID: <m3k4da$dut$1@loke.gir.dk> (raw)
In-Reply-To: bc4efa4f-7b39-4ca8-8c3b-503eef0039ea@googlegroups.com

"AdaMagica" <christ-usch.grein@t-online.de> wrote in message 
news:bc4efa4f-7b39-4ca8-8c3b-503eef0039ea@googlegroups.com...
> Am Donnerstag, 30. Oktober 2014 16:59:31 UTC+1 schrieb Mark Lorenzen:
>> In AI-0140 the following example code is given:
>>
>> with Ada.Unchecked_Deallocation;
>>
>> package UNC is
>>
>>    type My_String (<>) is limited private;
>>    type My_String_Access is access My_String;
>> private
>>    type My_String is new String;
>>    procedure Free is new
>>      Ada.Unchecked_Deallocation (My_String, My_String_Access);
>>
>> end UNC;
>>
>> The AI discusses if this is legal Ada or not.
>
> Hu - I've got severe problems to understand the AI. It says:
> "The full view of My_String is constrained, while My_String_Access 
> designates the partial view of My_String, which is unconstrained."
>
> But since when is type String constrained? So why is the full view of 
> My_String constrained?
>
> Am I blind?

I ran out of time to re-check the logic of this one before making it into an 
AI. So I copied the original discussion directly into the AI, but I agree it 
makes no sense as written. I'm sure I meant that the *partial view* is 
constrained. Brad points out that 3.7(26) says that it is unconstrained and 
indefinite, but this is not intended to be normative wording and only the 
"indefinite" part is backed up by other wording in the Standard (at least 
that I can find in a 30 second search of the RM).

In any case, the truly operative part is that we're statically matching a 
type with unknown discriminants to a type with no discriminants (and 
unconstrained bounds), and nothing in the Standard says that's allowed. 
("Nothing" certainly being different than "unknown"). I agree that the 
wording *should* allow this (the language would not make much sense if two 
views of the same subtype didn't match), but it doesn't. Thus the AI. (Why 
Janus/Ada implements this litererally, I don't know, but it's probably 
related to trying to get some ACATS test with picky rules checks to pass.)

                                       Randy.




  parent reply	other threads:[~2014-11-08  3:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 15:59 Question regarding example code in AI12-0140 Mark Lorenzen
2014-10-30 16:21 ` Adam Beneschan
2014-10-31 10:11   ` Mark Lorenzen
2014-10-31 19:40 ` AdaMagica
2014-11-01 15:31   ` Brad Moore
2014-11-08  3:58   ` Randy Brukardt [this message]
2014-11-08 19:20     ` AdaMagica
replies disabled

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