comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: GNAT or Language Problems?
Date: Thu, 22 Jun 2023 14:56:42 +0200	[thread overview]
Message-ID: <u71gea$38ekv$1@dont-email.me> (raw)
In-Reply-To: <u715id$38rs5$1@dont-email.me>

On 2023-06-22 11:51, Randy Brukardt wrote:
> You missed my point: The requirement that the subtypes are statically
> compatible was newly added. That applies to *all* subtypes, not just those
> with predicates. The reason the requirement was added had to do with
> predicates, but it might affect some marginal cases beyond that. It's a
> weaker requirement than static matching, but stronger than no requirement at
> all.
> 
> As I said the other day, you need to check if 4.9.1 allows or disallows your
> example (that's where the definition of static compatibility is found). If
> it allows it, then it's a compiler bug, if it doesn't allow it, it's an
> incompatibility with a language fix and you need to find a different way to
> do whatever it is you are doing.

Sorry, but I think you're wrong. The problem isn't static compatibility; it's 
static matching. The error msg says the subtypes must statically match, and the 
wording in 7.4(6/3) for deferred constants (which this is) refers to statically 
matching constraints. So static compatibility doesn't seem to be the issue.

> I don't have the energy tonight to go
> through that exercise myself (I apparently brought back a bug from Lisbon,
> and have spent much of the last several days in bed - but for some reason I
> seem to only be able to sleep during the day. Really louses up life...).

Sorry to hear that. Hope you feel better soon.

> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
> news:u6jtue$16d9e$1@dont-email.me...
>> On 2023-06-17 09:28, Randy Brukardt wrote:
>>> Regarding your second problem, refer to AI22-0041-1.
>>>
>>> Essentially, there are problems if predicates are involved. We changed
>>> the
>>> rule to require static compatibility (as a Binding Interpretation). I
>>> don't
>>> have the energy to look up what "static compatibility" requires in this
>>> case
>>> (enjoy figuring out 4.9.1). In some cases, it requires static matching,
>>> in
>>> others, it has weaker requirements.
>>
>> There are no predicates involved. One can cut it down to just the type and
>> constant:
>>
>> package B_Strings_Prob is
>>     type B_String (Max_Length : Positive := 1_000) is tagged limited
>> private;
>>
>>     Null_B_String : constant B_String; -- A string of zero characters
>> private -- B_Strings_Prob
>>     type B_String (Max_Length : Positive := 1_000) is tagged limited record
>>        Len   : Natural := 0;
>>        Value : String (1 .. Max_Length) := (1 .. Max_Length => ' ');
>>     end record;
>>
>>     Null_B_String : constant B_String := (Max_Length => 1, others => <>);
>> end B_Strings_Prob;
>>
>> and still get the error:
>>
>> $ gnatmake -gnatc b_strings_prob.ads
>> x86_64-linux-gnu-gcc-13 -c -gnatc b_strings_prob.ads
>> b_strings_prob.ads:12:04: error: subtype does not statically match
>> deferred declaration at line 5
>> gnatmake: "b_strings_prob.ads" compilation error
>>
>> I don't see any mention of AI22-0041-1 in ARM 7.4.
>>
>>> I don't have the time or energy tonight to look into your other problem.
>>> (I'm waiting for a backup to finish, or I would have already gone home --
>>> since I only got back from Lisbon last night, I'm not equipped for my
>>> usual
>>> late night work...)
>>
>> I'm surprised you're this functional already.
>>
>> -- 
>> Jeff Carter
>> "I was in love with a beautiful blonde once, dear.
>> She drove me to drink. That's the one thing I'm
>> indebted to her for."
>> Never Give a Sucker an Even Break
>> 109
>>
> 
> 

-- 
Jeff Carter
"[I]t is easy to use [Ada] just like any other
language: using only predefined types, using
packages just for separate compilation (without
any consideration for information hiding),
ignoring generics altogether, etc. I have seen
projects doing this; they didn't get much
gain from using Ada, and spent a lot of time
fighting the compiler."
Jean-Pierre Rosen
165

  reply	other threads:[~2023-06-22 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 16:36 GNAT or Language Problems? Jeffrey R.Carter
2023-06-17  7:28 ` Randy Brukardt
2023-06-17  9:21   ` Jeffrey R.Carter
2023-06-17 17:50     ` Bill Findlay
2023-06-17 20:49       ` Jeffrey R.Carter
2023-06-22  9:51     ` Randy Brukardt
2023-06-22 12:56       ` Jeffrey R.Carter [this message]
2023-06-23  9:55         ` Randy Brukardt
2023-06-24 12:23           ` Jeffrey R.Carter
2023-06-26 21:42             ` Randy Brukardt
2023-06-27 10:16               ` Jeffrey R.Carter
replies disabled

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