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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc3e3a6e4f85e03f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-10 22:07:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!enst!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: class wide object in generic package Date: Mon, 10 Jun 2002 13:07:47 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1023772025 97801 137.194.161.2 (11 Jun 2002 05:07:05 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 11 Jun 2002 05:07:05 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: jgvnFS8eDz64qr0/oSkH+w== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:25720 Date: 2002-06-10T13:07:47+02:00 > first: is it possible to declare a procedure in the > generic part so that it will be a primitive operation of > Object? > second: why isn't a class-wide argument not allowed > in this place? > > generic_pac.ads: > generic > type Object is abstract tagged private; > type Pointer is access all Object'class; > with procedure eval(o : in out Object); You can instantiate with any procedure that matches the profile, so the worst is assumed and Eval is not a primitive operation. > > package generic_pac is > type gen is record > p : Pointer; > end record; > > procedure use_it(g : in out gen); > > end generic_pac; > =========================================== > generic_pac.adb: > with Ada.Text_IO; use Ada.Text_IO; > > package body generic_pac is > procedure use_it(g : in out gen) is > begin > Put_Line("generic_pac.use_it"); > eval(g.p.all); Since Pointer is classwide, this is a dispatching call, but Eval is not primitive, so can't be used in a dispatching call. > end use_it; > end generic_pac;