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,68a59f01eb1998d3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s72.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada generics and private type operations References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <%GEXg.237659$1i1.167064@attbi_s72> NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s72 1160714043 12.201.97.213 (Fri, 13 Oct 2006 04:34:03 GMT) NNTP-Posting-Date: Fri, 13 Oct 2006 04:34:03 GMT Date: Fri, 13 Oct 2006 04:34:03 GMT Xref: g2news2.google.com comp.lang.ada:6941 Date: 2006-10-13T04:34:03+00:00 List-Id: Robert Sinclair wrote: > I've written a generic using Ada 95. The generic has 5 private types. > I'm trying to perform ">=" and "<=" operations on the private types to > no avail. I'm using 'With Function ">=" (l, r : private_type) return > boolean' in the declaration of the generic. I can't seem to figure out > how to code the instantiating program to actually perform the > operation. Can someone please provide a simple code example? There's your problem. You're capitalizing reserved words. Seriously, though, see ARM 12.2 and 12.6. generic -- GP type PT is private; with function ">=" (L : PT; R : PT) return Boolean [is <>]; package GP is function F (L : PT; R : PT) return Boolean; end GP; package body GP is function F (L : PT; R : PT) return Boolean is -- null; begin -- F return R >= L; end F; end GP; with GP; procedure GP_Test is package P is new GP (PT => Integer, ">=" => ">="); B : Boolean := P.F (Integer'First, Integer'Last); begin -- GP_Test null; end GP_Test; -- Jeff Carter "If you don't get the President of the United States on that phone, ... you're going to have to answer to the Coca-Cola Company." Dr. Strangelove 32