From: Anonymous Coward <bogus_addy@bogus_domain.net>
Subject: Re: Re-exporting primitive operations of a private type (like "-", and 'min)
Date: Tue, 01 Nov 2005 23:43:52 GMT
Date: 2005-11-01T23:43:52+00:00 [thread overview]
Message-ID: <slrndmg6ei.bmv.bogus_addy@tango.mindfuq.org> (raw)
In-Reply-To: ErC9f.4432$yX2.1697@newsread2.news.pas.earthlink.net
In article <ErC9f.4432$yX2.1697@newsread2.news.pas.earthlink.net>, Jeffrey R. Carter wrote:
>
> You should be able to say (in the private part)
>
> function Subtract (Left, Right : in Public_Distance_Type)
> return Public_Distance_Type renames "-";
>
> type Private_Distance_Type is new Public_Distance_Type;
> -- Subtract is defined for Private_Distance_Type.
>
> function "-" (Left, Right : in Private_Distance_Type)
> return Private_Distance_Type renames Subtract;
That would probably work as long as the definition of Subtract does a
type conversion explicitly on the Left and Right to the parent types.
But what are the advantages? Why would I define a Subtract operation
and use a renames clause, when I can simply define a "-" operation
directly?
The "-" operation must still be replaced, and it still has to have a
declaration in the public part. So in your case above, there would
have to be a
function "-" (Left, Right : in Private_Distance_Type)
return Private_Distance_Type;
in the public part.
next prev parent reply other threads:[~2005-11-01 23:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-29 21:19 Re-exporting primitive operations of a private type (like "-", and 'min) Anonymous Coward
2005-10-30 8:57 ` Dmitry A. Kazakov
2005-10-30 9:18 ` Jeffrey R. Carter
2005-10-30 14:16 ` Martin Krischik
2005-10-30 22:35 ` Robert A Duff
2005-10-31 4:15 ` Anonymous Coward
2005-10-31 4:34 ` Anonymous Coward
2005-10-31 6:14 ` Jeffrey R. Carter
2005-11-01 3:39 ` Anonymous Coward
2005-11-01 4:47 ` Jeffrey R. Carter
2005-11-01 23:43 ` Anonymous Coward [this message]
2005-11-02 3:35 ` Jeffrey R. Carter
2005-11-01 14:11 ` Robert A Duff
2005-10-31 8:27 ` Niklas Holsti
2005-10-31 9:18 ` Dmitry A. Kazakov
2005-11-02 9:50 ` Jean-Pierre Rosen
2005-11-03 9:15 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox