Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If I can have honesty, it's easier to overlook mistakes. -- Kirk, "Space Seed", stardate 3141.9


devel / comp.lang.ada / calling function but ignoring results

SubjectAuthor
* calling function but ignoring resultsMatt Borchers
+* Re: calling function but ignoring resultsJeffrey R. Carter
|+* Re: calling function but ignoring resultsDmitry A. Kazakov
||`* Re: calling function but ignoring resultsRandy Brukardt
|| `* Re: calling function but ignoring resultsG.B.
||  +* Re: calling function but ignoring resultsNiklas Holsti
||  |`- Re: calling function but ignoring resultsRandy Brukardt
||  `- Re: calling function but ignoring resultsShark8
|+- Re: calling function but ignoring resultsLuke A. Guest
|`* Re: calling function but ignoring resultsGabriele Galeotti
| `* Re: calling function but ignoring resultsMarius Amado-Alves
|  +- Re: calling function but ignoring resultsGabriele Galeotti
|  `* Re: calling function but ignoring resultsGabriele Galeotti
|   `* Re: calling function but ignoring resultsSimon Wright
|    +- Re: calling function but ignoring resultsSimon Wright
|    `- Re: calling function but ignoring resultsRandy Brukardt
+* Re: calling function but ignoring resultsLuke A. Guest
|+- Re: calling function but ignoring resultsSimon Wright
|`- Re: calling function but ignoring resultsRod Kay
+* Re: calling function but ignoring resultsStephen Leake
|`* Re: calling function but ignoring resultsRandy Brukardt
| `- Re: calling function but ignoring resultsStephen Leake
`* Re: calling function but ignoring resultsNasser M. Abbasi
 +* Re: calling function but ignoring resultsMatt Borchers
 |`* Re: calling function but ignoring resultsGautier write-only address
 | +- Re: calling function but ignoring resultsGautier write-only address
 | `- Re: calling function but ignoring resultsNiklas Holsti
 `- Re: calling function but ignoring resultsGautier write-only address

Pages:12
calling function but ignoring results

<69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:1c46:: with SMTP id if6mr32852399qvb.41.1624994726319;
Tue, 29 Jun 2021 12:25:26 -0700 (PDT)
X-Received: by 2002:a25:6d02:: with SMTP id i2mr39758000ybc.309.1624994726121;
Tue, 29 Jun 2021 12:25:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 29 Jun 2021 12:25:25 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=209.104.249.61; posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA-
NNTP-Posting-Host: 209.104.249.61
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
Subject: calling function but ignoring results
From: mattborc...@gmail.com (Matt Borchers)
Injection-Date: Tue, 29 Jun 2021 19:25:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Matt Borchers - Tue, 29 Jun 2021 19:25 UTC

It is not very often that ignoring a function result is okay, but I have run across many instances of the following block structure in code over the years:

declare
dont_care : BOOLEAN;
begin
dont_care := foo( x, y );
end;

I also see the procedure wrapper used in some cases -- usually when exported in a package specification:

procedure FOO( x, y ) is
b : BOOLEAN;
begin
b := foo( x, y );
end FOO;

The procedure adds nothing to the code except another thing to maintain when the function interface needs modification.

Is there a Ada 202x feature to support calling functions and ignoring the result? If not, I'm wondering if the @ symbol recently introduced for assignments could be used? How would people feel about the following?

@ := foo( x, y );

This would discard the result of the function. This could obviously lead to memory leaks (without reference counting), but the syntax could be restricted for use on functions that do not return uncontrolled access types or these functions could be marked with a keyword to make it legal for it to be called in such a way when the programmer knows that the access returned should not be "freed" by the caller (such as a pointer into an existing structure).

I have not given this much thought so I'm sure there are reasons why this can't (or shouldn't) be done in general. Regardless, there are probably many that would agree with me that the declare block and the wrapper procedure options are annoying and could be considered superfluous for lack of a better way to write the code more simply.

Matt

Re: calling function but ignoring results

<sbftm5$1gn$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.not.acm.org (Jeffrey R. Carter)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Tue, 29 Jun 2021 21:52:37 +0200
Organization: Also freenews.netfront.net; news.tornevall.net;
news.eternal-september.org
Lines: 20
Message-ID: <sbftm5$1gn$1@dont-email.me>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Jun 2021 19:52:38 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c6c39de7713edb046dd370a1aa3c147e";
logging-data="1559"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JMIIS4koa5PwdxPcVCUpYE1p7g3TlQUg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:OSk4Sg8D8Y71KwXVBo/RX50Epd4=
In-Reply-To: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R. Carter - Tue, 29 Jun 2021 19:52 UTC

On 6/29/21 9:25 PM, Matt Borchers wrote:
> It is not very often that ignoring a function result is okay, but I have run across many instances of the following block structure in code over the years:
>
> declare
> dont_care : BOOLEAN;
> begin
> dont_care := foo( x, y );
> end;

This sort of thing usually indicates a design problem.

> Is there a Ada 202x feature to support calling functions and ignoring the result?
If you want to use a language that allows this, then you probably shouldn't be
developing S/W.

--
Jeff Carter
"Blessed is just about anyone with a vested interest in the status quo."
Monty Python's Life of Brian
73

Re: calling function but ignoring results

<sbg04v$i7i$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Tue, 29 Jun 2021 22:34:41 +0200
Organization: Aioe.org NNTP Server
Lines: 68
Message-ID: <sbg04v$i7i$1@gioia.aioe.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me>
NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Tue, 29 Jun 2021 20:34 UTC

On 2021-06-29 21:52, Jeffrey R. Carter wrote:
> On 6/29/21 9:25 PM, Matt Borchers wrote:
>> It is not very often that ignoring a function result is okay, but I
>> have run across many instances of the following block structure in
>> code over the years:
>>
>> declare
>>      dont_care : BOOLEAN;
>> begin
>>      dont_care := foo( x, y );
>> end;
>
> This sort of thing usually indicates a design problem.

True. But there are exceptions from the rule:

1. Bindings to other languages. You normally have the result and you
quite often ignore it because it is useless.

2. Side effects of the call. Normally you would overload a function with
a procedure, like here:

function Pop (Stack : not null access Stack_Type) return Element;
procedure Pop (Stack : in out Stack_Type);

But you will have a problem (which BTW the proposal fail to address)
when overloading is solely on the result:

function Get (File : File_Type) return Integer;
function Get (File : File_Type) return Float;
function Get (File : File_Type) return String;

Now if you wanted to skip an integer in the file you could not do it in
the proposed way:

@ := Get (Standard_Input); -- Ambiguous

@ := Integer'(Get (Standard_Input)); -- Ugly

And of course, as many times proposed before a better syntax would be
the null statement:

null <expression>; -- Does not address the problem either

>> Is there a Ada 202x feature to support calling functions and ignoring
>> the result?
> If you want to use a language that allows this, then you probably
> shouldn't be developing S/W.

I would not say that pieces like:

declare
Ignore : constant Bar := Foo (Baz);
begin
null;
end;

or

if Foo (X) then null; end if;

are good engineering. But excessive overloading may lead to unexpected
collisions if you have many parameters with defaults.

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

Re: calling function but ignoring results

<sbh1lf$i1c$1@franka.jacob-sparre.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 01:06:38 -0500
Organization: JSA Research & Innovation
Lines: 52
Message-ID: <sbh1lf$i1c$1@franka.jacob-sparre.dk>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <sbftm5$1gn$1@dont-email.me> <sbg04v$i7i$1@gioia.aioe.org>
Injection-Date: Wed, 30 Jun 2021 06:06:39 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="18476"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Wed, 30 Jun 2021 06:06 UTC

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:sbg04v$i7i$1@gioia.aioe.org...
....
> Now if you wanted to skip an integer in the file you could not do it in
> the proposed way:
>
> @ := Get (Standard_Input); -- Ambiguous
>
> @ := Integer'(Get (Standard_Input)); -- Ugly

Maybe you think qualification is "ugly", but it is precisely the Ada tool
for this sort of problem. It wouldn't make sense to invent a new mechanism
when an existing one does the job just fine (and it's hard to imagine a
disambiguation mechanism that didn't include the subtype name).

> I would not say that pieces like:
>
> declare
> Ignore : constant Bar := Foo (Baz);
> begin
> null;
> end;

In Ada 202x, renaming is easier (assuming the usual case where overloading
isn't involved):

declare
Ignore renames Foo (Baz);
begin
null;
end;

BTW, I disagree with the OP's premise. To me, this sort of thing is
*exactly* what you need to do, since it makes it clear that you are ignoring
the result. And that typically is hidden inside of a thicker binding, so
it's pretty rare (it won't happen in well-designed Ada packages, but as
Dmitry says, it will often happen in interfacing, at least with the
Microsoft stuff!).

....

> But excessive overloading may lead to unexpected collisions if you have
> many parameters with defaults.

Excessive overloading is obviously bad, so the above doesn't say much. :-)
Determining when overloading is excessive is the hard part. Recent
experience suggests that a lot of overloading is ultimately execessive (the
need to change the name of some containers procedures demonstrates this!!)

Randy.

Re: calling function but ignoring results

<sbhgdg$ikd$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!JUN8/iIzeA71QWaIWFKODA.user.gioia.aioe.org.POSTED!not-for-mail
From: lagu...@archeia.com (Luke A. Guest)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 11:17:57 +0100
Organization: Aioe.org NNTP Server
Lines: 20
Message-ID: <sbhgdg$ikd$1@gioia.aioe.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me>
NNTP-Posting-Host: JUN8/iIzeA71QWaIWFKODA.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Luke A. Guest - Wed, 30 Jun 2021 10:17 UTC

On 29/06/2021 20:52, Jeffrey R. Carter wrote:

>> declare
>>      dont_care : BOOLEAN;
>> begin
>>      dont_care := foo( x, y );
>> end;
>
> This sort of thing usually indicates a design problem.

Or interfacing with C.

>
>> Is there a Ada 202x feature to support calling functions and ignoring
>> the result?
> If you want to use a language that allows this, then you probably
> shouldn't be developing S/W.
>

That's literally every C programmer then.

Re: calling function but ignoring results

<sbhgth$r7a$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!JUN8/iIzeA71QWaIWFKODA.user.gioia.aioe.org.POSTED!not-for-mail
From: lagu...@archeia.com (Luke A. Guest)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 11:26:30 +0100
Organization: Aioe.org NNTP Server
Lines: 18
Message-ID: <sbhgth$r7a$1@gioia.aioe.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
NNTP-Posting-Host: JUN8/iIzeA71QWaIWFKODA.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: Luke A. Guest - Wed, 30 Jun 2021 10:26 UTC

On 29/06/2021 20:25, Matt Borchers wrote:
> It is not very often that ignoring a function result is okay, but I have run across many instances of the following block structure in code over the years:
>
> declare
> dont_care : BOOLEAN;
> begin
> dont_care := foo( x, y );
> end;

declare
Dont_Care : constant Boolean := foo (x, y); -- Uppercase is so pascal!
pragma Unused (Dont_Care); -- GNAT specific
begin
null;
end;

I would put into a procedure, especially if it's a binding to C.

Re: calling function but ignoring results

<lyzgv7kv46.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org.POSTED!not-for-mail
From: sim...@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 20:31:05 +0100
Organization: Aioe.org NNTP Server
Lines: 19
Message-ID: <lyzgv7kv46.fsf@pushface.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbhgth$r7a$1@gioia.aioe.org>
NNTP-Posting-Host: yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
Cancel-Lock: sha1:ce2xNSvpy96rKABuQ4mS8tdERVM=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Simon Wright - Wed, 30 Jun 2021 19:31 UTC

"Luke A. Guest" <laguest@archeia.com> writes:

> declare
> Dont_Care : constant Boolean := foo (x, y); -- Uppercase is so pascal!
> pragma Unused (Dont_Care); -- GNAT specific
> begin
> null;
> end;

There are several names that you don't need pragma Unreferenced (not
Unused) for - see
https://docs.adacore.com/live/wave/gnat_rm/html/gnat_rm/gnat_rm/implementation_defined_pragmas.html#pragma-unreferenced

"For the variable case, warnings are never given for unreferenced
variables whose name contains one of the substrings DISCARD, DUMMY,
IGNORE, JUNK, UNUSED in any casing. Such names are typically to be
used in cases where such warnings are expected. Thus it is never
necessary to use pragma Unreferenced for such variables, though it is
harmless to do so."

Re: calling function but ignoring results

<sbitdh$nvd$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rodak...@gmail.com (Rod Kay)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Thu, 1 Jul 2021 09:06:21 +1000
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <sbitdh$nvd$1@dont-email.me>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbhgth$r7a$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Jun 2021 23:06:25 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="956be49824b317f2ebe6ed75d52b4d1c";
logging-data="24557"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iC0CcPal4JlLRtFI1lXaa2gFUq8demYs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:+WXcOpIP1WcwJpsDlcOKh9Ntis0=
In-Reply-To: <sbhgth$r7a$1@gioia.aioe.org>
Content-Language: en-US
 by: Rod Kay - Wed, 30 Jun 2021 23:06 UTC

On 30/6/21 8:26 pm, Luke A. Guest wrote:
>
> declare
>    Dont_Care : constant Boolean := foo (x, y); -- Uppercase is so pascal!
>    pragma Unused (Dont_Care); -- GNAT specific
> begin
>    null;
> end;
>

or even ...

declare
Dont_Care : constant Boolean := Foo (X, Y) with Unreferenced;
begin
null;
end;

Re: calling function but ignoring results

<867diayk1o.fsf@stephe-leake.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 17:06:27 -0700
Organization: Aioe.org NNTP Server
Lines: 26
Message-ID: <867diayk1o.fsf@stephe-leake.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:8b5qMyAnXr2qWloC9x7w5xg++Dk=
 by: Stephen Leake - Thu, 1 Jul 2021 00:06 UTC

Matt Borchers <mattborchers@gmail.com> writes:

> It is not very often that ignoring a function result is okay, but I
> have run across many instances of the following block structure in
> code over the years:
>
> declare
> dont_care : BOOLEAN;
> begin
> dont_care := foo( x, y );
> end;

With, GNAT, this can be:

declare
dont_care : BOOLEAN := foo( x, y );
pragma Unreferenced (dont_care);
begin
null;
end;

which makes the intent clear. I don't know if Unreferenced was proposed
as a language addition; it's not in Ada 202x.

--
-- Stephe

Re: calling function but ignoring results

<sbjeb1$fln$1@franka.jacob-sparre.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 22:55:12 -0500
Organization: JSA Research & Innovation
Lines: 23
Message-ID: <sbjeb1$fln$1@franka.jacob-sparre.dk>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <867diayk1o.fsf@stephe-leake.org>
Injection-Date: Thu, 1 Jul 2021 03:55:14 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="16055"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Thu, 1 Jul 2021 03:55 UTC

"Stephen Leake" <stephen_leake@stephe-leake.org> wrote in message
news:867diayk1o.fsf@stephe-leake.org...
....
> declare
> dont_care : BOOLEAN := foo( x, y );
> pragma Unreferenced (dont_care);
> begin
> null;
> end;
>
> which makes the intent clear. I don't know if Unreferenced was proposed
> as a language addition; it's not in Ada 202x.

Unreferenced controls warnings, which (with one exception) are not an Ada
concept. So how would we describe what it does? Aspect unreferenced does
nothing at all?? :-)

One could imagine an aspect that caused a Legality Rule against an actual
reference, but I don't think that is what the GNAT aspect does.

Randy.

Re: calling function but ignoring results

<d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:2e81:: with SMTP id u123mr1313234qkh.24.1625162862009;
Thu, 01 Jul 2021 11:07:42 -0700 (PDT)
X-Received: by 2002:a25:aa09:: with SMTP id s9mr1323962ybi.165.1625162861585;
Thu, 01 Jul 2021 11:07:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 1 Jul 2021 11:07:41 -0700 (PDT)
In-Reply-To: <sbftm5$1gn$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=95.238.131.152; posting-account=JRF_-woAAABYlsAtkCl_CUxBuQy2SsaQ
NNTP-Posting-Host: 95.238.131.152
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <sbftm5$1gn$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gabriele...@gmail.com (Gabriele Galeotti)
Injection-Date: Thu, 01 Jul 2021 18:07:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Gabriele Galeotti - Thu, 1 Jul 2021 18:07 UTC

On Tuesday, June 29, 2021 at 9:52:40 PM UTC+2, Jeffrey R. Carter wrote:
> On 6/29/21 9:25 PM, Matt Borchers wrote:
> > It is not very often that ignoring a function result is okay, but I have run across many instances of the following block structure in code over the years:
> >
> > declare
> > dont_care : BOOLEAN;
> > begin
> > dont_care := foo( x, y );
> > end;
> This sort of thing usually indicates a design problem.
> > Is there a Ada 202x feature to support calling functions and ignoring the result?
> If you want to use a language that allows this, then you probably shouldn't be
> developing S/W.
>
> --
> Jeff Carter
> "Blessed is just about anyone with a vested interest in the status quo."
> Monty Python's Life of Brian
> 73

Yes, you are right.
But sometimes it is necessary (especially at the H/W level) to force a read of
a peripheral register in order to obtain a specific behaviour, e.g., clear an interrupt
or latch a value previously written; in these cases what you read is useless.
G

Re: calling function but ignoring results

<58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:a5d5:: with SMTP id o204mr4183164qke.42.1625211143407;
Fri, 02 Jul 2021 00:32:23 -0700 (PDT)
X-Received: by 2002:a25:d4f:: with SMTP id 76mr5127222ybn.173.1625211143173;
Fri, 02 Jul 2021 00:32:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 2 Jul 2021 00:32:23 -0700 (PDT)
In-Reply-To: <d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.60.6.132; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY
NNTP-Posting-Host: 94.60.6.132
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me> <d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
Subject: Re: calling function but ignoring results
From: amado.al...@gmail.com (Marius Amado-Alves)
Injection-Date: Fri, 02 Jul 2021 07:32:23 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Marius Amado-Alves - Fri, 2 Jul 2021 07:32 UTC

On Thursday, 1 July 2021 at 19:07:43 UTC+1, Gabriele Galeotti wrote:
> But sometimes it is necessary...

Yes, but the frequency is too low to justify yet another feature of the language, IMO.

Re: calling function but ignoring results

<sboe5c$5q5$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!CoO8DKwN1NpS7UuKxER5kQ.user.gioia.aioe.org.POSTED!not-for-mail
From: nma...@12000.org (Nasser M. Abbasi)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Fri, 2 Jul 2021 20:22:55 -0500
Organization: Aioe.org NNTP Server
Lines: 31
Message-ID: <sboe5c$5q5$1@gioia.aioe.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
Reply-To: nma@12000.org
NNTP-Posting-Host: CoO8DKwN1NpS7UuKxER5kQ.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.7.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Nasser M. Abbasi - Sat, 3 Jul 2021 01:22 UTC

On 6/29/2021 2:25 PM, Matt Borchers wrote:
> It is not very often that ignoring a function result is okay, but I have run across many instances of the following block structure in code over the years:
>
> declare
> dont_care : BOOLEAN;
> begin
> dont_care := foo( x, y );
> end;
>
> I also see the procedure wrapper used in some cases -- usually when exported in a package specification:
>
> procedure FOO( x, y ) is
> b : BOOLEAN;
> begin
> b := foo( x, y );
> end FOO;
>

fyi, Matlab had this for years:

https://www.mathworks.com/help/matlab/matlab_prog/ignore-function-outputs.html

"
This example shows how to ignore specific outputs from a function using the tilde (~) operator.
To ignore function outputs in any position in the argument list, use the tilde operator. For example, ignore the first output using a tilde.

[~,name,ext] = fileparts(helpFile);

"

--Nasser

Re: calling function but ignoring results

<0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:a34a:: with SMTP id m71mr3464478qke.490.1625288358782;
Fri, 02 Jul 2021 21:59:18 -0700 (PDT)
X-Received: by 2002:a25:690e:: with SMTP id e14mr3564071ybc.277.1625288358545;
Fri, 02 Jul 2021 21:59:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 2 Jul 2021 21:59:18 -0700 (PDT)
In-Reply-To: <sboe5c$5q5$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:193:4101:a3a0:d572:63c2:a006:dae8;
posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA-
NNTP-Posting-Host: 2601:193:4101:a3a0:d572:63c2:a006:dae8
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <sboe5c$5q5$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com>
Subject: Re: calling function but ignoring results
From: mattborc...@gmail.com (Matt Borchers)
Injection-Date: Sat, 03 Jul 2021 04:59:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Matt Borchers - Sat, 3 Jul 2021 04:59 UTC

Thanks for the feedback. I guess I have to live with five lines to accomplish what one should do regardless of the numerous variety of ways to accomplish this. I mostly appreciate the wordiness of Ada for the clarity it offers to the code maintainers, but in some cases the extra wordiness offers nothing.

Related to this, I really appreciate the new parenthesized expressions as it offers a clean way to declare simple functions. GNAT 21.2 was just released today and includes declare expressions. I don't have the compiler yet, but I wonder if this would work:

procedure FOO( x, y ) is (declare b : BOOLEAN := foo( x, y ));

but it seems likely that an expression returns a value and would not be allowed in this instance.

Re: calling function but ignoring results

<08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:7047:: with SMTP id l68mr3818130qkc.417.1625297828808;
Sat, 03 Jul 2021 00:37:08 -0700 (PDT)
X-Received: by 2002:a25:6d02:: with SMTP id i2mr4170472ybc.309.1625297828532;
Sat, 03 Jul 2021 00:37:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 3 Jul 2021 00:37:08 -0700 (PDT)
In-Reply-To: <0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b;
posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sboe5c$5q5$1@gioia.aioe.org> <0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gautier_...@hotmail.com (Gautier write-only address)
Injection-Date: Sat, 03 Jul 2021 07:37:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Gautier write-only a - Sat, 3 Jul 2021 07:37 UTC

Le samedi 3 juillet 2021 à 06:59:19 UTC+2, Matt Borchers a écrit :
> Thanks for the feedback. I guess I have to live with five lines to accomplish what one should do regardless of the numerous variety of ways to accomplish this. I mostly appreciate the wordiness of Ada for the clarity it offers to the code maintainers, but in some cases the extra wordiness offers nothing.

If you use functions properly (only "in" parameters and not side effects) you don't have this issue at all.
Interfacing with C is an edge case which doesn't need to add more noise in the Ada syntax, IMHO.

Re: calling function but ignoring results

<e1bdf792-55e7-4312-9912-4a2ca15fbfd6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:5de4:: with SMTP id jn4mr3340370qvb.41.1625298158089; Sat, 03 Jul 2021 00:42:38 -0700 (PDT)
X-Received: by 2002:a25:d4f:: with SMTP id 76mr4457014ybn.173.1625298157919; Sat, 03 Jul 2021 00:42:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder5.feed.usenet.farm!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.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: Sat, 3 Jul 2021 00:42:37 -0700 (PDT)
In-Reply-To: <08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <sboe5c$5q5$1@gioia.aioe.org> <0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com> <08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e1bdf792-55e7-4312-9912-4a2ca15fbfd6n@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gautier_...@hotmail.com (Gautier write-only address)
Injection-Date: Sat, 03 Jul 2021 07:42:38 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 0
 by: Gautier write-only a - Sat, 3 Jul 2021 07:42 UTC

*no* side effects

Re: calling function but ignoring results

<79b3b0ff-8bc7-445a-b3a7-865a32f5d764n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:5f0d:: with SMTP id x13mr3386940qta.69.1625298363187;
Sat, 03 Jul 2021 00:46:03 -0700 (PDT)
X-Received: by 2002:a25:2b05:: with SMTP id r5mr4334908ybr.465.1625298363040;
Sat, 03 Jul 2021 00:46:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 3 Jul 2021 00:46:02 -0700 (PDT)
In-Reply-To: <sboe5c$5q5$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b;
posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1206:4564:bea0:54ae:2aa5:1ce8:336b
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> <sboe5c$5q5$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <79b3b0ff-8bc7-445a-b3a7-865a32f5d764n@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gautier_...@hotmail.com (Gautier write-only address)
Injection-Date: Sat, 03 Jul 2021 07:46:03 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Gautier write-only a - Sat, 3 Jul 2021 07:46 UTC

> [~,name,ext] = fileparts(helpFile);

In Ada it would be:
Info := File_Parts (Help_File);

You would use Info.name and Info.ext informations in the record only and ignore the other field.
Not much more complicated...

Re: calling function but ignoring results

<ikajj1Fari9U1@mid.individual.net>

  copy mid

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

  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.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Sat, 3 Jul 2021 10:57:20 +0300
Organization: Tidorum Ltd
Lines: 23
Message-ID: <ikajj1Fari9U1@mid.individual.net>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sboe5c$5q5$1@gioia.aioe.org>
<0cc35778-1d06-4e7d-853c-498735faf627n@googlegroups.com>
<08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net JWnr7N0tPqKjrRHBAPkmYQthTf0RpEumW+Ygh7rPKk/N+CbvMd
Cancel-Lock: sha1:BPDwjikK35C9YS1lFlwi32FMd84=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.11.0
In-Reply-To: <08c7e196-2bfc-49e9-9035-45a700b8687an@googlegroups.com>
Content-Language: en-US
 by: Niklas Holsti - Sat, 3 Jul 2021 07:57 UTC

On 2021-07-03 10:37, Gautier write-only address wrote:
> Le samedi 3 juillet 2021 à 06:59:19 UTC+2, Matt Borchers a écrit :
>> Thanks for the feedback. I guess I have to live with five lines to
>> accomplish what one should do regardless of the numerous variety of
>> ways to accomplish this. I mostly appreciate the wordiness of Ada
>> for the clarity it offers to the code maintainers, but in some
>> cases the extra wordiness offers nothing.
>
> If you use functions properly (only "in" parameters and not side
> effects) you don't have this issue at all.

However, the problem then changes to ignoring unneeded "out" parameters
of procedures, and the only way (currently) is to declare dummy output
variables and then leave them unused.

But it is not a big problem, and not worth changing the language, IMO.

> Interfacing with C is an edge case which doesn't need to add more
> noise in the Ada syntax, IMHO.

I agree.

Re: calling function but ignoring results

<865yxrispq.fsf@stephe-leake.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Sat, 03 Jul 2021 03:42:41 -0700
Organization: Aioe.org NNTP Server
Lines: 30
Message-ID: <865yxrispq.fsf@stephe-leake.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<867diayk1o.fsf@stephe-leake.org>
<sbjeb1$fln$1@franka.jacob-sparre.dk>
NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:zDFV5Hm/rqTBD5BPmHr8iaAr28Q=
 by: Stephen Leake - Sat, 3 Jul 2021 10:42 UTC

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

> "Stephen Leake" <stephen_leake@stephe-leake.org> wrote in message
> news:867diayk1o.fsf@stephe-leake.org...
> ...
>> declare
>> dont_care : BOOLEAN := foo( x, y );
>> pragma Unreferenced (dont_care);
>> begin
>> null;
>> end;
>>
>> which makes the intent clear. I don't know if Unreferenced was proposed
>> as a language addition; it's not in Ada 202x.
>
> Unreferenced controls warnings, which (with one exception) are not an Ada
> concept.

This could be another exception, or we could make it an Ada concept.

> So how would we describe what it does? Aspect unreferenced does
> nothing at all?? :-)
>
> One could imagine an aspect that caused a Legality Rule against an actual
> reference, but I don't think that is what the GNAT aspect does.

It does give you a warning if the variable is referenced.

--
-- Stephe

Re: calling function but ignoring results

<18affa36-2083-40dd-898e-4f1d51cfc7bcn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:1a1d:: with SMTP id f29mr4063980qtb.200.1625312105946;
Sat, 03 Jul 2021 04:35:05 -0700 (PDT)
X-Received: by 2002:a25:6d02:: with SMTP id i2mr5083467ybc.309.1625312105695;
Sat, 03 Jul 2021 04:35:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.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: Sat, 3 Jul 2021 04:35:05 -0700 (PDT)
In-Reply-To: <58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=95.238.131.152; posting-account=JRF_-woAAABYlsAtkCl_CUxBuQy2SsaQ
NNTP-Posting-Host: 95.238.131.152
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me> <d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
<58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <18affa36-2083-40dd-898e-4f1d51cfc7bcn@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gabriele...@gmail.com (Gabriele Galeotti)
Injection-Date: Sat, 03 Jul 2021 11:35:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1950
 by: Gabriele Galeotti - Sat, 3 Jul 2021 11:35 UTC

On Friday, July 2, 2021 at 9:32:24 AM UTC+2, amado...@gmail.com wrote:
> On Thursday, 1 July 2021 at 19:07:43 UTC+1, Gabriele Galeotti wrote:
> > But sometimes it is necessary...
>
> Yes, but the frequency is too low to justify yet another feature of the language, IMO.

Well, I agree it's ok to keep a rigid language semantics. The price to pay is then
accept some kind of warning (that add noise), or write the offending code
in an ad-hoc machine language fragment (which add further noise).
To be honest, I see this kind of feature as a "normal" pragma to the underlying
optimizer/linker/etc. Unfortunately, the H/W world is often far from perfect.

Re: calling function but ignoring results

<9ce930a5-d63e-4985-8371-1fc2836b554an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:678f:: with SMTP id b15mr4055839qtp.214.1625312766871;
Sat, 03 Jul 2021 04:46:06 -0700 (PDT)
X-Received: by 2002:a25:d4f:: with SMTP id 76mr5449307ybn.173.1625312766653;
Sat, 03 Jul 2021 04:46:06 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 3 Jul 2021 04:46:06 -0700 (PDT)
In-Reply-To: <58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=95.238.131.152; posting-account=JRF_-woAAABYlsAtkCl_CUxBuQy2SsaQ
NNTP-Posting-Host: 95.238.131.152
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me> <d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
<58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9ce930a5-d63e-4985-8371-1fc2836b554an@googlegroups.com>
Subject: Re: calling function but ignoring results
From: gabriele...@gmail.com (Gabriele Galeotti)
Injection-Date: Sat, 03 Jul 2021 11:46:06 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Gabriele Galeotti - Sat, 3 Jul 2021 11:46 UTC

On Friday, July 2, 2021 at 9:32:24 AM UTC+2, amado...@gmail.com wrote:
> On Thursday, 1 July 2021 at 19:07:43 UTC+1, Gabriele Galeotti wrote:
> > But sometimes it is necessary...
>
> Yes, but the frequency is too low to justify yet another feature of the language, IMO.

Note: in the last reply, I am referring to the use of pragma Unreferenced, not a new language feature.

G

Re: calling function but ignoring results

<lya6n32oxi.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org.POSTED!not-for-mail
From: sim...@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Sat, 03 Jul 2021 20:11:05 +0100
Organization: Aioe.org NNTP Server
Lines: 23
Message-ID: <lya6n32oxi.fsf@pushface.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me>
<d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
<58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
<9ce930a5-d63e-4985-8371-1fc2836b554an@googlegroups.com>
NNTP-Posting-Host: yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
Cancel-Lock: sha1:oFiZyyUAUTMAr/NcgOZiQs7lYJc=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Simon Wright - Sat, 3 Jul 2021 19:11 UTC

Gabriele Galeotti <gabriele.galeotti.xyz@gmail.com> writes:

> On Friday, July 2, 2021 at 9:32:24 AM UTC+2, amado...@gmail.com wrote:
>> On Thursday, 1 July 2021 at 19:07:43 UTC+1, Gabriele Galeotti wrote:
>> > But sometimes it is necessary...
>>
>> Yes, but the frequency is too low to justify yet another feature of
>> the language, IMO.
>
> Note: in the last reply, I am referring to the use of pragma
> Unreferenced, not a new language feature.

or aspect Unreferenced, or if you're prepared to accept GNAT extensions
anyway, just call the not-referenced variable Dummy, or Unused, or .. I
listed the relevant variable names upthread.

I suspect you _won't_ get a warning if you do reference a variable named
Dummy, but at that point it should be pretty obvious that something's
wrong.

I think any compiler needs some facility like this, at least if it has
any pretensions to interfacing to foreign languages; but it probably
won't be the same as Ada's.

Re: calling function but ignoring results

<ly5yxq35n3.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org.POSTED!not-for-mail
From: sim...@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Sun, 04 Jul 2021 08:22:24 +0100
Organization: Aioe.org NNTP Server
Lines: 9
Message-ID: <ly5yxq35n3.fsf@pushface.org>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me>
<d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com>
<58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com>
<9ce930a5-d63e-4985-8371-1fc2836b554an@googlegroups.com>
<lya6n32oxi.fsf@pushface.org>
NNTP-Posting-Host: yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
Cancel-Lock: sha1:JyIfF4eZI5jh8qi2TyNXCWHTSOw=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Simon Wright - Sun, 4 Jul 2021 07:22 UTC

Simon Wright <simon@pushface.org> writes:

> I think any compiler needs some facility like this, at least if it has
> any pretensions to interfacing to foreign languages; but it probably
> won't be the same as Ada's.

.... the same as *GNAT*'s.

Sorry, people

Re: calling function but ignoring results

<sc2nnr$vl4$1@franka.jacob-sparre.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Tue, 6 Jul 2021 18:07:38 -0500
Organization: JSA Research & Innovation
Lines: 19
Message-ID: <sc2nnr$vl4$1@franka.jacob-sparre.dk>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com><sbftm5$1gn$1@dont-email.me><d7a1a0ef-6789-4fc0-b9b3-c28411b4a8c4n@googlegroups.com><58bbf3ca-6252-4543-a50e-0483181d1b37n@googlegroups.com><9ce930a5-d63e-4985-8371-1fc2836b554an@googlegroups.com> <lya6n32oxi.fsf@pushface.org>
Injection-Date: Tue, 6 Jul 2021 23:07:40 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="32420"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Tue, 6 Jul 2021 23:07 UTC

"Simon Wright" <simon@pushface.org> wrote in message
news:lya6n32oxi.fsf@pushface.org...
....
> I think any compiler needs some facility like this, at least if it has
> any pretensions to interfacing to foreign languages; but it probably
> won't be the same as Ada's.

Perhaps "any compiler that tries to warn about unused objects". Janus/Ada
doesn't do that, so it doesn't need some facility to turn it off, either.
But I grant that if it did have such a warning, then some method to turn it
off is needed. (We have a pragma Warning_Level for turning off classes of
warnings in selective areas, nothing for individual warnings -- my
assumption has been that a warning message mught change when the compiler
gets upgraded, but the class of warning will not [unless of course there is
something else wrong].)

Randy.

Re: calling function but ignoring results

<sca3lg$de5$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: calling function but ignoring results
Date: Fri, 9 Jul 2021 20:14:07 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <sca3lg$de5$1@dont-email.me>
References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com>
<sbftm5$1gn$1@dont-email.me> <sbg04v$i7i$1@gioia.aioe.org>
<sbh1lf$i1c$1@franka.jacob-sparre.dk>
Reply-To: nonlegitur@notmyhomepage.de
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 9 Jul 2021 18:14:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a72b7055ca4d63c93f2dd0e320924cec";
logging-data="13765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18B+D0csjVa+fbJYEozCvNFnoPDimd7k4w="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Thunderbird/78.11.0
Cancel-Lock: sha1:m0mtJS7tgd9ZCL4mEelU+T7+14k=
In-Reply-To: <sbh1lf$i1c$1@franka.jacob-sparre.dk>
Content-Language: en-US
 by: G.B. - Fri, 9 Jul 2021 18:14 UTC

On 30.06.21 08:06, Randy Brukardt wrote:

> In Ada 202x, renaming is easier (assuming the usual case where overloading
> isn't involved):
>
> declare
> Ignore renames Foo (Baz);
> begin
> null;
> end;

Is this "type-less" naming a copy of the popular omission schemes
like auto in C++? Optional type annotations in Swift, or Scala?
Too many of those omissions have invited, uhm, a number of things.

They'll be good, for sure, when securing the workplace semantically;
also good for implementors of more complex type inference algorithms
and, consequently, for makers of the CPUs that are needed to properly
handle the omissions. I think the proper number of omissions is
a subject of research at ETH Zürich. They are trying to find
a sweet spot that makes inference finish in reasonable time.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor