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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,366b213c4abb1039 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: What makes a procedure call 'dispatching' in Ada? Date: Fri, 20 Nov 2009 10:31:38 +0100 Organization: Bauhaus-Universitaet Weimar Message-ID: References: Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: tigger.scc.uni-weimar.de 1258724042 29008 141.54.178.228 (20 Nov 2009 13:34:02 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Fri, 20 Nov 2009 13:34:02 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: Xref: g2news1.google.com comp.lang.ada:8167 X-Original-Bytes: 2753 Date: 2009-11-20T10:31:38+01:00 List-Id: If Foo is a tagged type, then "procedure A(This: [in] [out] Foo)" expects *exactly* the same type as the actual parameter. If you want "either type Foo or any of its object-oriented children" you write "procedure B(This: [in] [out] Foo'Class)". In your case, Foo is an abstract tagged type. As much as I seem to understand Ada, there is no way to actually call procedure A -- because you can't have any actuals of an abstract type. (Hey you guys out there, am I wrong?) If I am right, it is very regrettable that the compiler doesn't issue a warning when compiling "procedure A(This: [in] [out] Foo)" for an abstract type Foo ... perhaps better, a revised Ada should prohibit that. So long Stefan On Fri, 20 Nov 2009, Markus Schoepflin wrote: > ---%<--- > package FOOS is > > type FOO is abstract tagged null record; > > procedure P (THIS : in FOO); -------> replace by procedure P (THIS : in FOO'Class); > procedure A (THIS : in FOO) is abstract; > > end FOOS; > > package body FOOS is > > procedure P (THIS : in FOO) -------> replace by procedure P (THIS : in FOO'Class); > is > begin > A (THIS); > end; > > end FOOS; > --->%--- > > When trying to compile this, I get: > > foos.adb:6:07: call to abstract function must be dispatching > gnatmake: "foos.adb" compilation error > > What is the compiler trying to tell me here? And how do I go about calling > abstract procedures? > > TIA, > Markus > -- ------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------ Stefan dot Lucks at uni minus weimar dot de ------ I love the taste of Cryptanalysis in the morning! ------