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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8522260ffbf09d84 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-04 05:52:01 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: taashlo@cyberdude.com (Tad Ashlock) Newsgroups: comp.lang.ada Subject: Re: Problem With Self-Referential Access-to-Subprogram Type Date: 4 Nov 2003 05:52:01 -0800 Organization: http://groups.google.com Message-ID: References: <80teqv099lspc5d4osf2gmu7cld46i0lvb@4ax.com> NNTP-Posting-Host: 134.253.26.11 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1067953921 13196 127.0.0.1 (4 Nov 2003 13:52:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 4 Nov 2003 13:52:01 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:2037 Date: 2003-11-04T05:52:01-08:00 List-Id: Dmitry A. Kazakov wrote in message news:<80teqv099lspc5d4osf2gmu7cld46i0lvb@4ax.com>... > On 3 Nov 2003 08:58:45 -0800, taashlo@cyberdude.com (Tad Ashlock) > wrote: [snip] > > -- An access-to-procedure type that doesn't work: > > type State2; > > type State2 is access procedure (Tester : in out Test_Type'Class; > > Resultant_State : out State2); > > -- premature use of "State2" right here ^ > > type State2 is access procedure (Tester : in out Test_Type'Class; > Resultant_State : access State2); Sure, but why should I have to? What is the difference between a function return value and an "out" parameter that makes what I'm trying to do an error for one but not the other? [snip] > >Am I missing something obvious? > > You are using tagged types, why then you don't use dispatching calls? The example code in the original post didn't show it, but I *am* using dispatching calls, but along a different axis. But your idea is still an interesting one. Since Ada separates the concepts of packaging and type extension, there are some possibilities that I'll have to ponder. But my question above still stands. It appears that there is something special about a function return value that can't be replaced with a procedure "out" parameter. > Access to subprogram is a sort of polymorphism of poor man. Perhaps > you can review your design with that respect. Namely, to put the > knowledge of what should be done into Test_Type'Class. Probably it > would imply multiple dispatch/inheritance, then for both there are > workarounds in Ada. > > --- > Regards, > Dmitry Kazakov > www.dmitry-kazakov.de Dmitry, thank you, Tad