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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc3e3a6e4f85e03f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-10 06:00:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!wn4feed!worldnet.att.net!216.166.61.6!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin7.nnrp.aus1.giganews.com.POSTED!not-for-mail Sender: Stephe@TAKVER Newsgroups: comp.lang.ada Subject: Re: class wide object in generic package References: <3D045767.8020102@rcs.ei.tum.de> From: Stephen Leake Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-GC-Trace: gv1-YxWUOXx+XJI8vH9J9rX8S3EU8WkV5gZPA9CyNE= NNTP-Posting-Date: Mon, 10 Jun 2002 08:00:37 CDT Organization: Giganews.Com - Premium News Outsourcing X-Trace: sv3-3yBwz/mhKnbvFv+jQTy4P8T4U1Jg+efsx3gwqAYy1VH1P1ByKfjR6kcQa5D9KUt3JmNNXO/H4hVzGRK!5GzC9z1jMI9vtDZYRNczd6uK9QT0FcNidd6xbWxbidV+BzMrvjcStA== X-Complaints-To: abuse@comcast.com X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Date: Mon, 10 Jun 2002 13:00:37 GMT Xref: archiver1.google.com comp.lang.ada:25668 Date: 2002-06-10T13:00:37+00:00 List-Id: Thomas Maier-Komor writes: > Hi everybody, > > I am getting this error message when compiling the > code at the end of the message: > > generic_pac.adb:7:26: class-wide argument not allowed here > generic_pac.adb:7:26: "eval" is not a primitive operation of "Object" > > > my question is: > first: is it possible to declare a procedure in the > generic part so that it will be a primitive operation of > Object? No. All primitive operations are declared in the same declarative region as the type. > second: why isn't a class-wide argument not allowed in this place? Because "eval" isn't a primitive operation of Object :). Using a class-wide argument means you _want_ dispatching. Only primitive operations can be dispatching. You have a couple choices to make this work. If you don't actually need dispatching, you can make eval take a class-wide argument: with procedure eval(o : in out Object'class); If you want dispatching, you'll have to use a generic formal package parameter: generic package Object_Package is new Generic_Obj_Package (...); package generic_pac ... Then in Generic_Obj_Package, declare Object and Eval. Note that it has to be generic! Good luck, -- -- Stephe