Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Space is to place as eternity is to time. -- Joseph Joubert


devel / comp.lang.ada / Re: Is this an error in compiler

SubjectAuthor
* Is this an error in compilerreinert
`* Re: Is this an error in compilerSimon Wright
 +- Re: Is this an error in compilerreinert
 +* Re: Is this an error in compilerJeffrey R.Carter
 |+- Re: Is this an error in compilerDmitry A. Kazakov
 |`* Re: Is this an error in compilerNiklas Holsti
 | +* Re: Is this an error in compilerJeffrey R.Carter
 | |`* Re: Is this an error in compilerreinert
 | | `- Re: Is this an error in compilerDmitry A. Kazakov
 | `- Re: Is this an error in compilerSimon Wright
 `- Re: Is this an error in compilerOliver Kellogg

1
Is this an error in compiler

<4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:27e5:b0:4ac:a637:729 with SMTP id jt5-20020a05621427e500b004aca6370729mr3476041qvb.73.1662880746016;
Sun, 11 Sep 2022 00:19:06 -0700 (PDT)
X-Received: by 2002:a05:6214:c88:b0:4ac:a119:7ddf with SMTP id
r8-20020a0562140c8800b004aca1197ddfmr3903818qvr.126.1662880745849; Sun, 11
Sep 2022 00:19:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 11 Sep 2022 00:19:05 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
Subject: Is this an error in compiler
From: reinkor@gmail.com (reinert)
Injection-Date: Sun, 11 Sep 2022 07:19:06 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2888
 by: reinert - Sun, 11 Sep 2022 07:19 UTC

Hello,

I tried alire with the latest version of the compiler (I believe) and I got trouble
compiling this program (which I here have reduced just to communicate my point - i.e. the program has no other meaning here):
--------------------------------------------------------------------------------------------
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;

procedure c0a is

subtype String_1 is String (1 .. <>);

package cpros is
cfe0,cfe1,cfe2 : exception;
generic
with procedure execute_command1 (command1 : String);
procedure cpros0
(file1 : in Ada.Text_IO.File_Type; command0 : String := "");
end cpros;

package body cpros is

procedure cpros0 (file1 : in Ada.Text_IO.File_Type; command0 : String := "")
is
begin
declare
function rep1 (str0 : String_1) return String is
i : constant Natural := Index (str0, "$");
begin
return str0 when i = 0;
raise cfe2 with "(wrong use of '$')" when i = str0'Last; -- a
-- if i = str0'Last then -- b
-- raise cfe2 with "(wrong use of '$')"; -- b
-- end if; -- b
return "aaa";
end rep1;
str0 : constant String := rep1 (Get_Line (file1));
begin
null;
end;
end cpros0;
end cpros;

procedure execute_command1 (str : String) is
begin
null;
end execute_command1;

procedure cpros1 is new cpros.cpros0 (execute_command1 => execute_command1);

begin
null;
end c0a;
-----------------------------------------------------------------------------------------------
This goes through when I compile it.

However, if I uncomment the "a" line and comment out the "b" line (see code above), then I get the error message:

c0a.adb:45:04: error: instantiation error at line 27
c0a.adb:45:04: error: "cfe2" is not visible
c0a.adb:45:04: error: instantiation error at line 27
c0a.adb:45:04: error: non-visible declaration at line 10

Have you the same experience?

reinert

Re: Is this an error in compiler

<ly1qsi9vrv.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!Yr2L9qaRshuL+yFKTxsDBA.user.46.165.242.75.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 09:10:12 +0100
Organization: Aioe.org NNTP Server
Message-ID: <ly1qsi9vrv.fsf@pushface.org>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="51179"; posting-host="Yr2L9qaRshuL+yFKTxsDBA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:FxBeagp1Uk3mdWw8v3n04oq9LX0=
 by: Simon Wright - Sun, 11 Sep 2022 08:10 UTC

reinert <reinkor@gmail.com> writes:

(4 times!!!!)

> However, if I uncomment the "a" line and comment out the "b" line (see
> code above), then I get the error message:
>
> c0a.adb:45:04: error: instantiation error at line 27
> c0a.adb:45:04: error: "cfe2" is not visible
> c0a.adb:45:04: error: instantiation error at line 27
> c0a.adb:45:04: error: non-visible declaration at line 10
>
> Have you the same experience?

You have the conditions the wrong way round: if the 'a' line is
commented out and the 'b' lines are uncommented, the compilation
succeeds; the source as presented (and if compiled with -gnatX) fails in
the way you state.

And, yes, it's a compiler error.

I have to say these conditional constructs strike me as regrettable
Perl-isms, and reduce clarity:

return foo when blah;
raise baz when quux;

Re: Is this an error in compiler

<2161a6e8-a779-4219-8c8f-8260867f9598n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:a88a:0:b0:474:7f16:f272 with SMTP id x10-20020a0ca88a000000b004747f16f272mr19105597qva.4.1662893525452;
Sun, 11 Sep 2022 03:52:05 -0700 (PDT)
X-Received: by 2002:ac8:7dca:0:b0:344:5679:2dbb with SMTP id
c10-20020ac87dca000000b0034456792dbbmr19586718qte.245.1662893525287; Sun, 11
Sep 2022 03:52:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 11 Sep 2022 03:52:05 -0700 (PDT)
In-Reply-To: <ly1qsi9vrv.fsf@pushface.org>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com> <ly1qsi9vrv.fsf@pushface.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2161a6e8-a779-4219-8c8f-8260867f9598n@googlegroups.com>
Subject: Re: Is this an error in compiler
From: reinkor@gmail.com (reinert)
Injection-Date: Sun, 11 Sep 2022 10:52:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1462
 by: reinert - Sun, 11 Sep 2022 10:52 UTC

søndag 11. september 2022 kl. 10:10:19 UTC+2 skrev Simon Wright:
> reinert <rei...@gmail.com> writes:
>
> (4 times!!!!)
>
4 times?

The google system must have been too quick to store/spread my message before me deleting.
It seems not to consider dysleksi :-)

reinert

Re: Is this an error in compiler

<tfkkcj$1talo$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 14:30:11 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <tfkkcj$1talo$1@dont-email.me>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 11 Sep 2022 12:30:11 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7b9e293f2127e05240c5856be7c4c5a8";
logging-data="2009784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v7HxaVtOgnaH9zaQ3T61J+rmBTZYfJcs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:kmQTN7Rc/cHezXuo8RvcDIwOFf4=
Content-Language: en-US
In-Reply-To: <ly1qsi9vrv.fsf@pushface.org>
 by: Jeffrey R.Carter - Sun, 11 Sep 2022 12:30 UTC

On 2022-09-11 10:10, Simon Wright wrote:
>
> I have to say these conditional constructs strike me as regrettable
> Perl-isms, and reduce clarity:
>
> return foo when blah;
> raise baz when quux;

I presume you never use

exit Name when Condition;

since it must reduce clarity as well.

I suggested these constructs for Ada 9X. They were rejected because you could
get the same functionality with an if statement, and the ARG had more important
things to spend their time on. I guess the ARG's workload must have decreased.

--
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35

Re: Is this an error in compiler

<tfkm3d$cj4$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!epJzlJsZWlp1WuFmYLlBpQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 14:59:25 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tfkm3d$cj4$1@gioia.aioe.org>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="12900"; posting-host="epJzlJsZWlp1WuFmYLlBpQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Sun, 11 Sep 2022 12:59 UTC

On 2022-09-11 14:30, Jeffrey R.Carter wrote:
> On 2022-09-11 10:10, Simon Wright wrote:
>>
>> I have to say these conditional constructs strike me as regrettable
>> Perl-isms, and reduce clarity:
>>
>>     return foo when blah;
>>     raise baz when quux;
>
> I presume you never use
>
> exit Name when Condition;
>
> since it must reduce clarity as well.
>
> I suggested these constructs for Ada 9X. They were rejected because you
> could get the same functionality with an if statement, and the ARG had
> more important things to spend their time on. I guess the ARG's workload
> must have decreased.

And the evaluation order of the return value vs the condition? E.g. in

return Boolean'Input (Stream) when Boolean'Input (Stream);

There is no issue with exit-when of course. Return and, even, raise (as
you can have an expressions there with Exception_Occurrence type) look
problematic.

I would expect the condition evaluated first, but that is kind of
"German" way of reading texts... 😂

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

Re: Is this an error in compiler

<jo6ahtFfaipU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.holsti@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 17:44:13 +0300
Organization: Tidorum Ltd
Lines: 31
Message-ID: <jo6ahtFfaipU1@mid.individual.net>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fp8cQnsmNaH51B6F0z/EegHXIP77CvvKqeljrudVJg2Y1ynu37
Cancel-Lock: sha1:HySvKdREZO/y/DL83zg+yuKMfwg=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.2.2
Content-Language: en-US
In-Reply-To: <tfkkcj$1talo$1@dont-email.me>
 by: Niklas Holsti - Sun, 11 Sep 2022 14:44 UTC

On 2022-09-11 15:30, Jeffrey R.Carter wrote:
> On 2022-09-11 10:10, Simon Wright wrote:
>>
>> I have to say these conditional constructs strike me as regrettable
>> Perl-isms, and reduce clarity:
>>
>>     return foo when blah;
>>     raise baz when quux;
>
> I presume you never use
>
> exit Name when Condition;
>
> since it must reduce clarity as well.
>
> I suggested these constructs for Ada 9X. They were rejected because you
> could get the same functionality with an if statement, and the ARG had
> more important things to spend their time on. I guess the ARG's workload
> must have decreased.

I don't find these "raise .. when" or "return .. when" constructs in the
Ada 2022 RM draft, so I don't think the ARG has adopted them (yet). I
suspect they are GNAT extensions, as is the ability to make a subtype of
String with a fixed lower index bound of 1 but an unconstrained upper
bound (1 .. <>), as also done in the OP's code.

I would not use these non-standard GNAT extensions, as long as GNAT is
not the only Ada compiler in the world, which it fortunately isn't.

Re: Is this an error in compiler

<9263a570-325f-4f9c-a06a-7b4dc54712fcn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:174b:b0:343:1fc:14d8 with SMTP id l11-20020a05622a174b00b0034301fc14d8mr19735283qtk.579.1662909291332;
Sun, 11 Sep 2022 08:14:51 -0700 (PDT)
X-Received: by 2002:a05:620a:4450:b0:6bb:c19a:c022 with SMTP id
w16-20020a05620a445000b006bbc19ac022mr15978662qkp.240.1662909291127; Sun, 11
Sep 2022 08:14:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 11 Sep 2022 08:14:50 -0700 (PDT)
In-Reply-To: <ly1qsi9vrv.fsf@pushface.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:e7:ff00:eaa4:a5b9:ca5e:71e9:81ca;
posting-account=Md_OIgoAAAAkZyQ6nYoc3WBIThMpPfV7
NNTP-Posting-Host: 2003:e7:ff00:eaa4:a5b9:ca5e:71e9:81ca
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com> <ly1qsi9vrv.fsf@pushface.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9263a570-325f-4f9c-a06a-7b4dc54712fcn@googlegroups.com>
Subject: Re: Is this an error in compiler
From: olivermkellogg@gmail.com (Oliver Kellogg)
Injection-Date: Sun, 11 Sep 2022 15:14:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1661
 by: Oliver Kellogg - Sun, 11 Sep 2022 15:14 UTC

On Sunday, September 11, 2022 at 10:10:19 AM UTC+2, Simon Wright wrote:
> reinert <rei...@gmail.com> writes:
> > [...]
> I have to say these conditional constructs strike me as regrettable
> Perl-isms, and reduce clarity:
>
> return foo when blah;
> raise baz when quux;

+1 on that.
On the other hand,

blah and return foo;
quux and raise baz;

would make more sense to me.
Not that I am proposing it, IMO Ada already has way too many extensions.

Re: Is this an error in compiler

<tfkvu9$1vrpq$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 17:47:21 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <tfkvu9$1vrpq$1@dont-email.me>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
<jo6ahtFfaipU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 11 Sep 2022 15:47:21 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="179e3da0ebb938b876b475b0690662e1";
logging-data="2092858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6pf3oWVEhZrrION3mPrHfdDEyUI9oy2A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:3PqJU5KGNP3L4fc4nJdh6+zHNn0=
Content-Language: en-US
In-Reply-To: <jo6ahtFfaipU1@mid.individual.net>
 by: Jeffrey R.Carter - Sun, 11 Sep 2022 15:47 UTC

On 2022-09-11 16:44, Niklas Holsti wrote:
>
> I don't find these "raise .. when" or "return .. when" constructs in the Ada
> 2022 RM draft, so I don't think the ARG has adopted them (yet). I suspect they
> are GNAT extensions, as is the ability to make a subtype of String with a fixed
> lower index bound of 1 but an unconstrained upper bound (1 .. <>), as also done
> in the OP's code.

Sorry, I didn't realize AdaCore was distributing GNAT for non-Ada.

> I would not use these non-standard GNAT extensions, as long as GNAT is not the
> only Ada compiler in the world, which it fortunately isn't.

I won't even use the Ada-2X features until it's supported by multiple compilers.

--
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35

Re: Is this an error in compiler

<a1d0cc99-bdf2-4415-9b01-fbddb9818751n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:27e9:b0:4aa:9ff0:e8de with SMTP id jt9-20020a05621427e900b004aa9ff0e8demr19670303qvb.99.1662914846843;
Sun, 11 Sep 2022 09:47:26 -0700 (PDT)
X-Received: by 2002:ae9:e114:0:b0:6ce:33c9:5cc2 with SMTP id
g20-20020ae9e114000000b006ce33c95cc2mr1201899qkm.388.1662914846676; Sun, 11
Sep 2022 09:47:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 11 Sep 2022 09:47:26 -0700 (PDT)
In-Reply-To: <tfkvu9$1vrpq$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
<jo6ahtFfaipU1@mid.individual.net> <tfkvu9$1vrpq$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a1d0cc99-bdf2-4415-9b01-fbddb9818751n@googlegroups.com>
Subject: Re: Is this an error in compiler
From: reinkor@gmail.com (reinert)
Injection-Date: Sun, 11 Sep 2022 16:47:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 7
 by: reinert - Sun, 11 Sep 2022 16:47 UTC

Could the result of

if function1 and function2 then ....

depend on the order of evaluation ( in some rare situations when f.eks. function2 affects the outcome from function1)?

reinert

Re: Is this an error in compiler

<tfl58u$17u2$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!epJzlJsZWlp1WuFmYLlBpQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Sun, 11 Sep 2022 19:18:24 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tfl58u$17u2$1@gioia.aioe.org>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
<jo6ahtFfaipU1@mid.individual.net> <tfkvu9$1vrpq$1@dont-email.me>
<a1d0cc99-bdf2-4415-9b01-fbddb9818751n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="40898"; posting-host="epJzlJsZWlp1WuFmYLlBpQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Sun, 11 Sep 2022 17:18 UTC

On 2022-09-11 18:47, reinert wrote:
> Could the result of
>
> if function1 and function2 then ....
>
> depend on the order of evaluation ( in some rare situations when f.eks. function2 affects the outcome from function1)?

The order is only one half of the problem. Another one is eager
evaluation. Both function1 and function2 are guaranteed to be evaluated
in absence of exceptions.

Short-circuit operators are meant to enforce both the order of
evaluation and laziness of the second term:

if function1 and then function2 then ....

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

Re: Is this an error in compiler

<lyleqphy35.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!Yr2L9qaRshuL+yFKTxsDBA.user.46.165.242.75.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: Is this an error in compiler
Date: Mon, 12 Sep 2022 08:05:18 +0100
Organization: Aioe.org NNTP Server
Message-ID: <lyleqphy35.fsf@pushface.org>
References: <4eecf346-667a-4dee-80b2-c3597b0f6fa7n@googlegroups.com>
<ly1qsi9vrv.fsf@pushface.org> <tfkkcj$1talo$1@dont-email.me>
<jo6ahtFfaipU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="18909"; posting-host="Yr2L9qaRshuL+yFKTxsDBA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
Cancel-Lock: sha1:J0XmtYPAuWMY5xI/7JMP9prjAhE=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Simon Wright - Mon, 12 Sep 2022 07:05 UTC

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> I don't find these "raise .. when" or "return .. when" constructs in
> the Ada 2022 RM draft, so I don't think the ARG has adopted them
> (yet). I suspect they are GNAT extensions, as is the ability to make a
> subtype of String with a fixed lower index bound of 1 but an
> unconstrained upper bound (1 .. <>), as also done in the OP's code.

Indeed.

c0a.adb:7:37: error: fixed-lower-bound array is a GNAT specific extension
c0a.adb:7:37: error: unit must be compiled with -gnatX switch
c0a.adb:26:28: error: return when statement is a GNAT specific extension
c0a.adb:26:28: error: unit must be compiled with -gnatX switch
c0a.adb:27:59: error: raise when statement is a GNAT specific extension
c0a.adb:27:59: error: unit must be compiled with -gnatX switch


devel / comp.lang.ada / Re: Is this an error in compiler

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor