From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1514d4f994aed7aa X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: generic function and overloading Date: Thu, 18 Oct 2007 10:18:35 +0200 Organization: Adalog Message-ID: References: <1192688972.967825.31130@t8g2000prg.googlegroups.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-8-I; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1192698074 2713 195.25.228.57 (18 Oct 2007 09:01:14 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Thu, 18 Oct 2007 09:01:14 +0000 (UTC) User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <1192688972.967825.31130@t8g2000prg.googlegroups.com> Xref: g2news2.google.com comp.lang.ada:2477 Date: 2007-10-18T10:18:35+02:00 List-Id: 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