* Generic child unit renaming
@ 1999-04-21 0:00 noiraud
1999-04-22 0:00 ` dennison
0 siblings, 1 reply; 4+ messages in thread
From: noiraud @ 1999-04-21 0:00 UTC (permalink / raw)
I would like to rename Math_Extension an extension of the
generic package Ada.Numerics.Generic_Elementary_Functions.
Thus, I created a generic child unit :
generic
package Ada.Numerics.Generic_Elementary_Functions.Extensions is
function Log10 (X : Float_Type'Base) return Float_Type'Base;
function Asin (X : Float_Type'Base) Return Float_Type'Base
renames Arcsin;
end Ada.Numerics.Generic_Elementary_Functions.Extensions;
and I tried the following renaming :
with Ada.Numerics.Generic_Elementary_Functions.Extensions;
generic package Math_Extension renames
Ada.Numerics.Generic_Elementary_Functions.Extensions;
The GNAT compiler refused it :
>>> invalid prefix in selected component "Generic_Elementary_Functions".
I read that renaming is possible if realized in the parent unit, but
I can't do it because Generic_Elementary_Functions belongs to the
predefined library.
Could anyone help me ?
Thanks in advance.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic child unit renaming
1999-04-21 0:00 Generic child unit renaming noiraud
@ 1999-04-22 0:00 ` dennison
1999-04-25 0:00 ` Matthew Heaney
0 siblings, 1 reply; 4+ messages in thread
From: dennison @ 1999-04-22 0:00 UTC (permalink / raw)
In article <7fkvbt$q1r$1@ilana.cenaath.cena.dgac.fr>,
noiraud@cenaath.cena.dgac.fr wrote:
>
>
> I would like to rename Math_Extension an extension of the
> generic package Ada.Numerics.Generic_Elementary_Functions.
My understanding is that users are not allowed to make children of
language-defined units (eg: anything in Ada.*). That would allow you
visibility into the private section of any language-defined unit, which would
allow you to do unspeakable things.
I think Gnat does have a compiler flag to allow you to do it, but unless you
are working on a compiler extension, you probably shouldn't use it.
--
T.E.D.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic child unit renaming
1999-04-22 0:00 ` dennison
@ 1999-04-25 0:00 ` Matthew Heaney
1999-04-26 0:00 ` Robert Dewar
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Heaney @ 1999-04-25 0:00 UTC (permalink / raw)
dennison@telepath.com writes:
> My understanding is that users are not allowed to make children of
> language-defined units (eg: anything in Ada.*).
I think the rule is that you can't have _direct_ children of Ada, but
that the language doesn't prohibit indirect children, ie grandchildren
are allowed.
> That would allow you visibility into the private section of any
> language-defined unit, which would allow you to do unspeakable things.
But that's my choice to make. The language, and the compiler vendor,
should get out of my way.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic child unit renaming
1999-04-25 0:00 ` Matthew Heaney
@ 1999-04-26 0:00 ` Robert Dewar
0 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1999-04-26 0:00 UTC (permalink / raw)
In article <m3k8v0mh3n.fsf@mheaney.ni.net>,
Matthew Heaney <matthew_heaney@acm.org> wrote:
> But that's my choice to make. The language, and the
> compiler vendor, should get out of my way.
We constantly run into users who do this sort of thing,
and then yell loudly when their code breaks on a new
release. There is a VERY good reason to prevent this
sort of thing!
Note that the RM specifically allows the implementation
to be restrictive here:
4 The implementation may restrict the replacement of
language-defined compilation units. The implementation
may restrict children of language-defined library units
(other than Standard).
In GNAT, you must be an implementor to add children to
language defined library units. In particular you have to
obey GNAT style rules and use the -gnatg switch.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-04-26 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-21 0:00 Generic child unit renaming noiraud
1999-04-22 0:00 ` dennison
1999-04-25 0:00 ` Matthew Heaney
1999-04-26 0:00 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox