comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Generic package with dynamic subprogram name?
Date: Wed, 09 Jun 2010 16:37:41 -0700
Date: 2010-06-09T16:37:41-07:00	[thread overview]
Message-ID: <hup8n8$hdk$1@tornado.tornevall.net> (raw)
In-Reply-To: <hup6qr$mmm$1@adenine.netfront.net>

Marek Janukowicz wrote:
> 
> generic
>   Attr : String;
> package Get_Set is
>   function Get_Attribute return String;
>   procedure Set_Attribute ( Value : String );
> end Get_Set;
> 
> But if I then instantiate:
> package Get_Set_First_Name is new Get_Set( "FirstName" );
> package Get_Set_Last_Name is new Get_Set( "LastName" );
> 
> subprogram names will overlap. I know I can call them using package prefix, 
> but I'd really like to have nice API like here:
> Get_First_Name( ... );
> Set_Last_Name( ... );

function Get_First_Name return String renames Get_Set_First_Name.Get_Attribute;
procedure Set_First_Name (First_Name : in String) renames 
Get_Set_First_Name.Set_Attribute;

-- 
Jeff Carter
"I've got to stay here, but there's no reason
why you folks shouldn't go out into the lobby
until this thing blows over."
Horse Feathers
50



  reply	other threads:[~2010-06-09 23:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 23:07 Generic package with dynamic subprogram name? Marek Janukowicz
2010-06-09 23:37 ` Jeffrey R. Carter [this message]
2010-06-10  6:05   ` Ludovic Brenta
2010-06-10  7:33 ` Stephen Leake
2010-06-10 10:14   ` Brian Drummond
2010-06-10 10:48     ` Yannick Duchêne (Hibou57)
2010-06-10 12:13     ` sjw
2010-06-11  9:08     ` Stephen Leake
2010-06-11  9:55       ` J-P. Rosen
2010-06-11 12:19       ` Brian Drummond
replies disabled

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