comp.lang.ada
 help / color / mirror / Atom feed
From: taashlo@cyberdude.com (Tad Ashlock)
Subject: Re: Problem With Self-Referential Access-to-Subprogram Type
Date: 4 Nov 2003 05:52:01 -0800
Date: 2003-11-04T05:52:01-08:00	[thread overview]
Message-ID: <c8f570aa.0311040552.79e3ba7c@posting.google.com> (raw)
In-Reply-To: 80teqv099lspc5d4osf2gmu7cld46i0lvb@4ax.com

Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> 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



  reply	other threads:[~2003-11-04 13:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-03 16:58 Problem With Self-Referential Access-to-Subprogram Type Tad Ashlock
2003-11-04 10:04 ` Dmitry A. Kazakov
2003-11-04 13:52   ` Tad Ashlock [this message]
2003-11-04 14:24     ` Dmitry A. Kazakov
2003-11-04 14:52       ` Marius Amado Alves
2003-11-05  8:31         ` Dmitry A. Kazakov
2003-11-05 11:27           ` Marius Amado Alves
2003-11-05 13:33             ` Dmitry A. Kazakov
2003-11-05 14:02               ` Marius Amado Alves
2003-11-05 17:49             ` Adam Beneschan
2003-11-05 18:55               ` Marius Amado Alves
2003-11-05 22:54                 ` Tad Ashlock
2003-11-06 17:45                   ` Warren W. Gay VE3WWG
  -- strict thread matches above, loose matches on Subject: below --
2003-11-03 17:32 amado.alves
2003-11-04 14:02 ` Tad Ashlock
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox