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,f8ab3336640d0856,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-16 20:06:16 PST Path: bga.com!news.sprintlink.net!cs.utexas.edu!uwm.edu!msunews!harbinger.cc.monash.edu.au!aggedor.rmit.EDU.AU!goanna.cs.rmit.edu.au!macdale.cs.rmit.edu.au!dale From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: How to dynamically dispatch? Date: 16 Mar 1995 06:36:31 GMT Organization: RMIT, Melbourne, Australia Distribution: world Message-ID: <3k8m9f$eci@goanna.cs.rmit.edu.au> NNTP-Posting-Host: macdale.cs.rmit.edu.au X-UserAgent: Version 1.1.3 X-XXMessage-ID: X-XXDate: Thu, 16 Mar 95 17:37:45 GMT Date: 1995-03-16T06:36:31+00:00 List-Id: I'm currently having problems figuring out how to dispatch to the appropriate routines for the package (based on an example in the LRM) below... package expression is type expression is tagged null record; type literal is new Expression with record value :integer; end record; function eval(item:literal) return integer; type Expr_ptr is access all Expression'class; type binary_operation is new Expression with record Left, Right: Expr_ptr; end record; type addition is new Binary_operation with null record; function eval(item:addition) return integer; type subtraction is new binary_operation with null record; function eval(item:subtraction) return integer; end; The body is.... package body expression is function eval(item:literal) return integer is begin return item.value; end; function eval(item:addition) return integer is begin return eval(item.left.all) + eval(item.right.all); end; function eval(item:subtraction) return integer is begin return eval(item.left.all) - eval(item.right.all); end; end; ...but Gnat just says "invalid parameter list in call" for each of the eval calls. To me this seems the same the example in "Introducing Ada9x" in section 2.2. Any thoughts? Dale