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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2aed634b0d2edf21 X-Google-Attributes: gid103376,public From: John English Subject: Re: Run Time Dispatch Question Date: 2000/02/25 Message-ID: <38B6837E.7208F8C8@bton.ac.uk>#1/1 X-Deja-AN: 589854933 Content-Transfer-Encoding: 7bit References: <895q4e$5up$1@ssauraaa-i-1.production.compuserve.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@bton.ac.uk X-Trace: saturn.bton.ac.uk 951485125 4148 193.62.183.204 (25 Feb 2000 13:25:25 GMT) Organization: University of Brighton Mime-Version: 1.0 NNTP-Posting-Date: 25 Feb 2000 13:25:25 GMT Newsgroups: comp.lang.ada Date: 2000-02-25T13:25:25+00:00 List-Id: Michael Garrett wrote: > I am having a problem understanding run time dispatching. ( Basic question I > know, but I'm having a brain cramp. ) > [...snip...] You need to put your tagged type t and primitive p in a package, not a procedure. Otherwise, the procedure p(...) defined for each type derived from t is just an overload of the name p, not a primitive of the type. Dispatching only happens for primitives. To quote RM95 3.2.3: The primitive subprograms of a specific type are defined as follows: a) The predefined operators of the type (see 4.5); b) For a derived type, the inherited (see 3.4) user-defined subprograms; c) For an enumeration type, the enumeration literals (which are considered parameterless functions -- see 3.5.1); d) For a specific type declared immediately within a package_specification, any subprograms (in addition to the enumeration literals) that are explicitly declared immediately within the same package_specification and that operate on the type; e) Any subprograms not covered above that are explicitly declared immediately within the same declarative region as the type and that override (see 8.3) other implicitly declared primitive subprograms of the type. So, if t and p were declared in a package then p would be a primitive (by (d)), and overloading p for t1 and t2 would make them primitives too (by (e)). ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------