comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Question about name resolution
Date: Tue, 20 Jan 2015 17:47:20 -0700
Date: 2015-01-20T17:47:20-07:00	[thread overview]
Message-ID: <m9mstq$hja$1@dont-email.me> (raw)
In-Reply-To: <m9magv$a8e$1@speranza.aioe.org>

On 01/20/2015 12:32 PM, Michael B. wrote:
> 
> I was surprised that this compiles without warnings if neither of the procedures
> is called. Why is such overloading allowed in Ada? It seems to make no sense to
> write a procedure that cannot be called directly.

Duff has discussed the current state of Ada regarding this. In Ada 80,
subprograms without parameters had to be called with an empty parameter list.
This was universally reviled and so it was removed in Ada 83.

I don't remember enough about this to say how it would have applied in your
case. The illustration of the difference I remember was

function F (I : Integer) return Integer; -- F1

type IA is array (Integer range <>) of Integer;

function F return IA; -- F2


In Ada 83 and later, the call

   F (5)

is ambiguous. It could either be

F1 with an argument of 5

or

F2 with the result indexed by 5

In Ada 80 this was unambiguous; the call could only be to F1. To call F2 one had
to write

F () (5)

This is not very helpful but I always like an excuse to air the useless trivia
in my head.

-- 
Jeff Carter
"Ada has made you lazy and careless. You can write programs in C that
are just as safe by the simple application of super-human diligence."
E. Robert Tisdale
72

  parent reply	other threads:[~2015-01-21  0:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 18:47 Question about name resolution Michael B.
2015-01-20 19:00 ` Jeffrey Carter
2015-01-20 19:32   ` Michael B.
2015-01-20 20:39     ` Robert A Duff
2015-01-21 18:25       ` Michael B.
2015-01-21  0:47     ` Jeffrey Carter [this message]
2015-01-21 10:54       ` Brian Drummond
2015-01-20 19:43 ` Robert A Duff
replies disabled

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