comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: generic function and overloading
Date: Thu, 18 Oct 2007 10:18:35 +0200
Date: 2007-10-18T10:18:35+02:00	[thread overview]
Message-ID: <us47ff.ln6.ln@hunter.axlog.fr> (raw)
In-Reply-To: <1192688972.967825.31130@t8g2000prg.googlegroups.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=ISO-8859-8-I; format=flowed, Size: 1038 bytes --]

eliben a e'crit :
> [...] In Ada, however, when using generics it doesn't seem I can
> leave the same function name for all types (as I would do in
> overloading). I can define a generic Bit_Set, but then I have to
> specialize it for uin16 and uint32 with different function names. Is
> there any way I could combine the effects of generics and overloading
> and get a single Bit_Set for all my types without writing the code N
> times ?
> 
You should give the exact specification of your generic and of your 
instantiations to get a precise answer, but here is a wild guess at what 
is happenning:

The *generic* cannot have the same name as the instantiations. However, 
different *instantiations* can have the same name, provided the 
resulting functions have different profiles. In short, call your generic 
"Generic_Bit_Set", and then you can call all instantiations "Bit_Set".

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2007-10-18  8:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18  7:28 generic function and overloading eliben
2007-10-18  8:18 ` Jean-Pierre Rosen [this message]
2007-10-18  9:31 ` Dmitry A. Kazakov
2007-10-18  9:33   ` Dmitry A. Kazakov
2007-10-18 10:32 ` Georg Bauhaus
2007-10-18 11:07 ` Stephen Leake
2007-10-18 11:30 ` Stefan Lucks
2007-10-18 15:58 ` Robert A Duff
2007-10-18 20:20   ` Simon Wright
2007-10-18 21:23     ` Robert A Duff
2007-10-19  5:19       ` Simon Wright
2007-10-19 13:59         ` Robert A Duff
2007-10-18 18:58 ` Dr. Adrian Wrigley
2007-10-18 22:30   ` Adam Beneschan
replies disabled

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