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,f5e08b0286d9be14 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: GNAT: identifier for stub is not unique Date: Sun, 18 Nov 2007 18:45:43 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1195082122.273134.263390@v2g2000hsf.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1195429543 3794 192.74.137.71 (18 Nov 2007 23:45:43 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 18 Nov 2007 23:45:43 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:H4g2L4sdwvyYL2OBn5lGRJbugKU= Xref: g2news1.google.com comp.lang.ada:18489 Date: 2007-11-18T18:45:43-05:00 List-Id: "Jeffrey R. Carter" writes: > braver wrote: >> How in GNAT can we have two subunits for two overloaded functions with >> the same name? What should be they named? > > You cannot. This is not a GNAT issue; this restriction is part of the > language (ARM 10.1.3): "The defining_identifiers of all body_stubs that > appear immediately within a particular declarative_part shall be > distinct." That's right, but you can use renaming to get around this restriction: package P is procedure Overloaded(X: Integer); procedure Overloaded(X: Boolean); end P; package body P is procedure Integer_Op(X: Integer) is separate; procedure Boolean_Op(X: Boolean) is separate; procedure Overloaded(X: Integer) renames Integer_Op; procedure Overloaded(X: Boolean) renames Boolean_Op; end P; The "is separate"s are required to have different names, but you can use overloading in the interface for clients nonetheless, if that's what you want. - Bob