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,FREEMAIL_FROM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf581b184a645a4c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-20 16:18:07 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!feeder.nmix.net!feeder.swcp.com!sloth.swcp.com!not-for-mail From: "Klatt, Nathan" Newsgroups: comp.lang.ada Subject: Dispatching and Child Packages Date: Tue, 20 Mar 2001 17:12:48 -0700 Organization: Southwest Cyberport Message-ID: <998rhs$fr4$1@sloth.swcp.com> NNTP-Posting-Host: dpm2-03.swcp.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Xref: supernews.google.com comp.lang.ada:5947 Date: 2001-03-20T17:12:48-07:00 List-Id: Is it possible to dispatch from within a child package? The below code does not work. If I collapse the child packages into their respective parents, it dispatches as expected. (Ndk is an empty package.) Thanks, Nathan Klatt ---------------------------------------------------------------------------- package Ndk.Base is type Base is abstract tagged null record; end Ndk.Base; ---------------------------------------------------------------------------- package Ndk.Base.Child is procedure Do_Something (This : Base'Class); procedure Real_Do_Something (This : Base) is abstract; end Ndk.Base.Child; ---------------------------------------------------------------------------- package body Ndk.Base.Child is procedure Do_Something (This : Base'Class) is begin Real_Do_Something (This); end Do_Something; end Ndk.Base.Child; ---------------------------------------------------------------------------- with Ndk.Base; package Ndk.Sub is type Sub is new Ndk.Base.Base with null record; end Ndk.Sub; ---------------------------------------------------------------------------- package Ndk.Sub.Child is procedure Real_Do_Something (This : Sub); end Ndk.Sub.Child; ---------------------------------------------------------------------------- with Ada.Text_Io; package body Ndk.Sub.Child is procedure Real_Do_Something (This : Sub) is begin Ada.Text_Io.Put_Line ("Sub doing something..."); end Real_To_String; end Ndk.Sub.Child; ---------------------------------------------------------------------------- Compiler error: Real_Do_Something (This); is a call on an abstract subprogram which should be a dispatching call [RM_95 3.9.3(7)] RM_95 3.9.3(7) says... A call on an abstract subprogram shall be a dispatching call; nondispatching calls to an abstract subprogram are not allowed.