Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I'm still waiting for the advent of the computer science groupie.


devel / comp.lang.ada / error: choice must be static?

SubjectAuthor
* error: choice must be static?Blady
+* Re: error: choice must be static?Jeffrey R.Carter
|`- Re: error: choice must be static?Dmitry A. Kazakov
`* Re: error: choice must be static?Randy Brukardt
 `* Re: error: choice must be static?Simon Wright
  `* Re: error: choice must be static?Randy Brukardt
   `- Re: error: choice must be static?Blady

1
error: choice must be static?

<uqaek7$vd8o$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10415&group=comp.lang.ada#10415

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: error: choice must be static?
Date: Sun, 11 Feb 2024 13:29:59 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <uqaek7$vd8o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 11 Feb 2024 12:30:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d7fb2a2c9a59dddde27b49f6bb25abf7";
logging-data="1029400"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19uoSdXdaDJMcs1GzRexRX2"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ZpaLo5ONBuYR7S66FSb4Ki3tBw8=
Content-Language: fr, en-US
 by: Blady - Sun, 11 Feb 2024 12:29 UTC

Hello,

I've got the following GNAT error:

$ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
GNAT 13.2.0
1. procedure test_20240211_static_choice is
2.
3. package Maps is
4. type Map_Type is private
5. with Aggregate => (Empty => Empty_Map,
6. Add_Named => Add_To_Map);
7. procedure Add_To_Map (M : in out Map_Type; Key : in
Integer; Value : in String);
8. Empty_Map : constant Map_Type;
9. private
10. type Map_Type is array (1..10) of String (1..10);
11. procedure Add_To_Map (M : in out Map_Type; Key : in
Integer; Value : in String) is null;
12. Empty_Map : constant Map_Type := [1..10 => " "];
-- error: choice must be static
|
>>> error: choice must be static

13. end;
14.
15. begin
16. null;
17. end;

I wonder what more static it should be.
Any clue ?

Thanks, Pascal.

Source code:
procedure test_20240211_static_choice is

package Maps is
type Map_Type is private
with Aggregate => (Empty => Empty_Map,
Add_Named => Add_To_Map);
procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
Value : in String);
Empty_Map : constant Map_Type;
private
type Map_Type is array (1..10) of String (1..10);
procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
Value : in String) is null;
Empty_Map : constant Map_Type := [1..10 => " "]; --
error: choice must be static
end;

begin
null;
end;

Re: error: choice must be static?

<uqbc9h$12olv$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10416&group=comp.lang.ada#10416

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Sun, 11 Feb 2024 21:56:17 +0100
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <uqbc9h$12olv$1@dont-email.me>
References: <uqaek7$vd8o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 11 Feb 2024 20:56:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4fd62ceeba554ba2f7871a4c75001588";
logging-data="1139391"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UvJu8I70I0CvaX+FqzdMqZOJwBaH9u9E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:pwwewrBlPA/E3BAkXennqxLGXyk=
In-Reply-To: <uqaek7$vd8o$1@dont-email.me>
Content-Language: en-US
 by: Jeffrey R.Carter - Sun, 11 Feb 2024 20:56 UTC

On 2024-02-11 13:29, Blady wrote:
> Hello,
>
> I've got the following GNAT error:
>
> $ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
> GNAT 13.2.0
>      1. procedure test_20240211_static_choice is
>      2.
>      3.    package Maps is
>      4.       type Map_Type is private
>      5.         with Aggregate =>  (Empty     => Empty_Map,
>      6.                             Add_Named => Add_To_Map);
>      7.       procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String);
>      8.       Empty_Map : constant Map_Type;
>      9.    private
>     10.       type Map_Type is array (1..10) of String (1..10);
>     11.       procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String) is null;
>     12.       Empty_Map : constant Map_Type := [1..10 => "          "]; --
> error: choice must be static
>                                                  |
>         >>> error: choice must be static
>
>     13.    end;
>     14.
>     15. begin
>     16.    null;
>     17. end;
>
> I wonder what more static it should be.

I don't know what this means, but it's definitely related to the Aggregate
aspect. This compiles:

procedure Test_20240211_Static_Choice is
package Maps is
type Map_Type is private
with Aggregate => (Empty => Empty_Map,
Add_Named => Add_To_Map);
procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in
String);
Empty_Map : constant Map_Type;
private
type Map_Base is array (1 .. 10) of String (1 .. 10);
type Map_Type is new Map_Base;
procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in
String) is null;
Empty_Base : constant Map_Base := (1 .. 10 => (1 .. 10 => ' ') );
Empty_Map : constant Map_Type := Map_Type (Empty_Base);
end Maps;
begin
null;
end Test_20240211_Static_Choice;

--
Jeff Carter
"Nobody expects the Spanish Inquisition!"
Monty Python's Flying Circus
22

Re: error: choice must be static?

<uqcjtl$1dnsm$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10417&group=comp.lang.ada#10417

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Mon, 12 Feb 2024 09:12:37 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uqcjtl$1dnsm$1@dont-email.me>
References: <uqaek7$vd8o$1@dont-email.me> <uqbc9h$12olv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 12 Feb 2024 08:12:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5ae14b73778a7f8862ce65bb09f81124";
logging-data="1499030"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KPizrWI5A6WhIaN7z9NEMAUusaL1HylI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gDBG1OspadPM7ESBOQRdgm4+6T4=
In-Reply-To: <uqbc9h$12olv$1@dont-email.me>
Content-Language: en-US
 by: Dmitry A. Kazakov - Mon, 12 Feb 2024 08:12 UTC

On 2024-02-11 21:56, Jeffrey R.Carter wrote:

> I don't know what this means, but it's definitely related to the
> Aggregate aspect.

Square brackets is the root of all evil! (:-))

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

Re: error: choice must be static?

<uqej3l$1prfv$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10419&group=comp.lang.ada#10419

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Mon, 12 Feb 2024 20:12:01 -0600
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <uqej3l$1prfv$1@dont-email.me>
References: <uqaek7$vd8o$1@dont-email.me>
Injection-Date: Tue, 13 Feb 2024 02:11:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b3f6773f6607d6dae636052a24857e93";
logging-data="1895935"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SkknveDLLfsk75fI7nnGOWYd1bK4CmRQ="
Cancel-Lock: sha1:/sWfG/5uhWjFOM29+VcU/HdCyeY=
X-Priority: 3
X-RFC2646: Format=Flowed; Response
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
 by: Randy Brukardt - Tue, 13 Feb 2024 02:12 UTC

Looks like a compiler bug to me. The nonsense message gives that away... :-)

Randy.

"Blady" <p.p11@orange.fr> wrote in message
news:uqaek7$vd8o$1@dont-email.me...
> Hello,
>
> I've got the following GNAT error:
>
> $ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
> GNAT 13.2.0
> 1. procedure test_20240211_static_choice is
> 2.
> 3. package Maps is
> 4. type Map_Type is private
> 5. with Aggregate => (Empty => Empty_Map,
> 6. Add_Named => Add_To_Map);
> 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String);
> 8. Empty_Map : constant Map_Type;
> 9. private
> 10. type Map_Type is array (1..10) of String (1..10);
> 11. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String) is null;
> 12. Empty_Map : constant Map_Type := [1..10 => " "]; --
> error: choice must be static
> |
> >>> error: choice must be static
>
> 13. end;
> 14.
> 15. begin
> 16. null;
> 17. end;
>
> I wonder what more static it should be.
> Any clue ?
>
> Thanks, Pascal.
>
> Source code:
> procedure test_20240211_static_choice is
>
> package Maps is
> type Map_Type is private
> with Aggregate => (Empty => Empty_Map,
> Add_Named => Add_To_Map);
> procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value :
> in String);
> Empty_Map : constant Map_Type;
> private
> type Map_Type is array (1..10) of String (1..10);
> procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value :
> in String) is null;
> Empty_Map : constant Map_Type := [1..10 => " "]; --
> error: choice must be static
> end;
>
> begin
> null;
> end;

Re: error: choice must be static?

<lybk8klh9u.fsf@pushface.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10420&group=comp.lang.ada#10420

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Tue, 13 Feb 2024 11:45:17 +0000
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <lybk8klh9u.fsf@pushface.org>
References: <uqaek7$vd8o$1@dont-email.me> <uqej3l$1prfv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="c5f3580d54f0b664f0245f64a1dbe9db";
logging-data="2185145"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pfCbkzEMuZVUJKze1qovgzbs4oGyQgSw="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
Cancel-Lock: sha1:owaY79OxwSZmI9kaopOmeYlmCYo=
sha1:1R0+jYh1+X12khIE9zscwwaFcKg=
 by: Simon Wright - Tue, 13 Feb 2024 11:45 UTC

"Randy Brukardt" <randy@rrsoftware.com> writes:

> Looks like a compiler bug to me. The nonsense message gives that away... :-)

GCC 14.0.1 says

1. procedure test_20240211_static_choice is
2.
3. package Maps is
4. type Map_Type is private
5. with Aggregate => (Empty => Empty_Map,
|
>>> error: aspect "Aggregate" can only be applied to non-array type

6. Add_Named => Add_To_Map);
7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
8. Value : in String);
9. Empty_Map : constant Map_Type;
10. private
11. type Map_Type is array (1..10) of String (1..10);
12. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
13. Value : in String) is null;
14. Empty_Map : constant Map_Type := [1..10 => " "];
|
>>> error: choice must be static

15. end;
16.
17. begin
18. null;
19. end;

I think the first is because of ARM 4.3.5(2), "For a type other than an
array type, the following type-related operational aspect may be
specified"[1] and the second is a "nonsense" consequence.

[1] http://www.ada-auth.org/standards/22rm/html/RM-4-3-5.html#p2

Re: error: choice must be static?

<uqhffa$2ghd9$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10421&group=comp.lang.ada#10421

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Tue, 13 Feb 2024 22:28:22 -0600
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uqhffa$2ghd9$1@dont-email.me>
References: <uqaek7$vd8o$1@dont-email.me> <uqej3l$1prfv$1@dont-email.me> <lybk8klh9u.fsf@pushface.org>
Injection-Date: Wed, 14 Feb 2024 04:27:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fd8ce468f87ca1b6498a13521cc30f06";
logging-data="2639273"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192aJqAQuvBDo9C1k6Pd1TFmFI4dymuFbQ="
Cancel-Lock: sha1:WU7wvE/w4JEVsy36uyQGLmYKn/8=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-MSMail-Priority: Normal
X-Priority: 3
 by: Randy Brukardt - Wed, 14 Feb 2024 04:28 UTC

Ah, yes, didn't notice that part. One cannot give the Aggregate aspect on an
array type, directly or indirectly. That's because container aggregates are
designed to work like array aggregates, and we didn't want visibility to
determine the interpretation of an aggregate (especially where the same
syntax could have a different meaning in different visibility).. Thus, there
can be no point where a single type can have both array aggregates and
container aggregates.

Note that record aggregates and container aggregates are always syntactally
different, and thus it is OK to have both in a single location (that's one
of the reasons that we adopted square brackets for container aggregates).
That seemed important as the majority of private types are completed by
record types, and not allowing record types in this context would be
difficult to work around.

Randy.

"Simon Wright" <simon@pushface.org> wrote in message
news:lybk8klh9u.fsf@pushface.org...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
>> Looks like a compiler bug to me. The nonsense message gives that away...
>> :-)
>
> GCC 14.0.1 says
>
> 1. procedure test_20240211_static_choice is
> 2.
> 3. package Maps is
> 4. type Map_Type is private
> 5. with Aggregate => (Empty => Empty_Map,
> |
> >>> error: aspect "Aggregate" can only be applied to non-array type
>
> 6. Add_Named => Add_To_Map);
> 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> 8. Value : in String);
> 9. Empty_Map : constant Map_Type;
> 10. private
> 11. type Map_Type is array (1..10) of String (1..10);
> 12. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> 13. Value : in String) is null;
> 14. Empty_Map : constant Map_Type := [1..10 => " "];
> |
> >>> error: choice must be static
>
> 15. end;
> 16.
> 17. begin
> 18. null;
> 19. end;
>
> I think the first is because of ARM 4.3.5(2), "For a type other than an
> array type, the following type-related operational aspect may be
> specified"[1] and the second is a "nonsense" consequence.
>
> [1] http://www.ada-auth.org/standards/22rm/html/RM-4-3-5.html#p2

Re: error: choice must be static?

<uqps2r$b2je$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10436&group=comp.lang.ada#10436

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Re: error: choice must be static?
Date: Sat, 17 Feb 2024 09:51:39 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uqps2r$b2je$1@dont-email.me>
References: <uqaek7$vd8o$1@dont-email.me> <uqej3l$1prfv$1@dont-email.me>
<lybk8klh9u.fsf@pushface.org> <uqhffa$2ghd9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 17 Feb 2024 08:51:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3742d425f9950990e38548bf005fe799";
logging-data="363118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19B5AOfpj0ZrO7P5i5Xb9s8"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:s1PF/6zl0DlBoEzCO1M6LujqAQY=
Content-Language: fr, en-US
In-Reply-To: <uqhffa$2ghd9$1@dont-email.me>
 by: Blady - Sat, 17 Feb 2024 08:51 UTC

Le 14/02/2024 à 05:28, Randy Brukardt a écrit :
> Ah, yes, didn't notice that part. One cannot give the Aggregate aspect on an
> array type, directly or indirectly. That's because container aggregates are
> designed to work like array aggregates, and we didn't want visibility to
> determine the interpretation of an aggregate (especially where the same
> syntax could have a different meaning in different visibility).. Thus, there
> can be no point where a single type can have both array aggregates and
> container aggregates.
>
> Note that record aggregates and container aggregates are always syntactally
> different, and thus it is OK to have both in a single location (that's one
> of the reasons that we adopted square brackets for container aggregates).
> That seemed important as the majority of private types are completed by
> record types, and not allowing record types in this context would be
> difficult to work around.

Thanks Randy for the explanation, it helps.

Pascal.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor