* GNAT: identifier for stub is not unique
@ 2007-11-14 23:15 braver
2007-11-14 23:50 ` Jeffrey R. Carter
0 siblings, 1 reply; 4+ messages in thread
From: braver @ 2007-11-14 23:15 UTC (permalink / raw)
How in GNAT can we have two subunits for two overloaded functions with
the same name? What should be they named?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNAT: identifier for stub is not unique
2007-11-14 23:15 GNAT: identifier for stub is not unique braver
@ 2007-11-14 23:50 ` Jeffrey R. Carter
2007-11-18 23:45 ` Robert A Duff
0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey R. Carter @ 2007-11-14 23:50 UTC (permalink / raw)
braver wrote:
> How in GNAT can we have two subunits for two overloaded functions with
> the same name? What should be they named?
You cannot. This is not a GNAT issue; this restriction is part of the language
(ARM 10.1.3): "The defining_identifiers of all body_stubs that appear
immediately within a particular declarative_part shall be distinct."
--
Jeff Carter
"Don't knock masturbation. It's sex with someone I love."
Annie Hall
45
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNAT: identifier for stub is not unique
2007-11-14 23:50 ` Jeffrey R. Carter
@ 2007-11-18 23:45 ` Robert A Duff
2007-11-21 23:05 ` braver
0 siblings, 1 reply; 4+ messages in thread
From: Robert A Duff @ 2007-11-18 23:45 UTC (permalink / raw)
"Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org> writes:
> braver wrote:
>> How in GNAT can we have two subunits for two overloaded functions with
>> the same name? What should be they named?
>
> You cannot. This is not a GNAT issue; this restriction is part of the
> language (ARM 10.1.3): "The defining_identifiers of all body_stubs that
> appear immediately within a particular declarative_part shall be
> distinct."
That's right, but you can use renaming to get around this restriction:
package P is
procedure Overloaded(X: Integer);
procedure Overloaded(X: Boolean);
end P;
package body P is
procedure Integer_Op(X: Integer) is separate;
procedure Boolean_Op(X: Boolean) is separate;
procedure Overloaded(X: Integer) renames Integer_Op;
procedure Overloaded(X: Boolean) renames Boolean_Op;
end P;
The "is separate"s are required to have different names, but you can use
overloading in the interface for clients nonetheless, if that's what you
want.
- Bob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNAT: identifier for stub is not unique
2007-11-18 23:45 ` Robert A Duff
@ 2007-11-21 23:05 ` braver
0 siblings, 0 replies; 4+ messages in thread
From: braver @ 2007-11-21 23:05 UTC (permalink / raw)
Bob -- awesome, thanks! My faith in the naming freedom in Ada and
separate compilation is affirmed.
Cheers,
Alexy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-21 23:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-14 23:15 GNAT: identifier for stub is not unique braver
2007-11-14 23:50 ` Jeffrey R. Carter
2007-11-18 23:45 ` Robert A Duff
2007-11-21 23:05 ` braver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox