From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: calling function but ignoring results
Date: Wed, 30 Jun 2021 01:06:38 -0500 [thread overview]
Message-ID: <sbh1lf$i1c$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: sbg04v$i7i$1@gioia.aioe.org
"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.
next prev parent reply other threads:[~2021-06-30 6:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 19:25 calling function but ignoring results Matt Borchers
2021-06-29 19:52 ` Jeffrey R. Carter
2021-06-29 20:34 ` Dmitry A. Kazakov
2021-06-30 6:06 ` Randy Brukardt [this message]
2021-07-09 18:14 ` G.B.
2021-07-09 19:20 ` Niklas Holsti
2021-07-10 2:57 ` Randy Brukardt
2021-07-12 15:56 ` Shark8
2021-06-30 10:17 ` Luke A. Guest
2021-07-01 18:07 ` Gabriele Galeotti
2021-07-02 7:32 ` Marius Amado-Alves
2021-07-03 11:35 ` Gabriele Galeotti
2021-07-03 11:46 ` Gabriele Galeotti
2021-07-03 19:11 ` Simon Wright
2021-07-04 7:22 ` Simon Wright
2021-07-06 23:07 ` Randy Brukardt
2021-06-30 10:26 ` Luke A. Guest
2021-06-30 19:31 ` Simon Wright
2021-06-30 23:06 ` Rod Kay
2021-07-01 0:06 ` Stephen Leake
2021-07-01 3:55 ` Randy Brukardt
2021-07-03 10:42 ` Stephen Leake
2021-07-03 1:22 ` Nasser M. Abbasi
2021-07-03 4:59 ` Matt Borchers
2021-07-03 7:37 ` Gautier write-only address
2021-07-03 7:42 ` Gautier write-only address
2021-07-03 7:57 ` Niklas Holsti
2021-07-03 7:46 ` Gautier write-only address
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox