From: taashlo@cyberdude.com (Tad Ashlock)
Subject: Re: Problem With Self-Referential Access-to-Subprogram Type
Date: 5 Nov 2003 14:54:29 -0800
Date: 2003-11-05T14:54:29-08:00 [thread overview]
Message-ID: <c8f570aa.0311051454.4e3928d0@posting.google.com> (raw)
In-Reply-To: mailman.285.1068058551.25614.comp.lang.ada@ada-france.org
Marius Amado Alves <amado.alves@netcabo.pt> wrote in message news:<mailman.285.1068058551.25614.comp.lang.ada@ada-france.org>...
> On Wed, 2003-11-05 at 17:49, Adam Beneschan wrote:
> > ... The feeling at the time was that
> > the additional work needed to change the language and the compilers
> > shouldn't be required if no one has run into the problem in practice.
> > I've let them know that someone now has run into it.
>
> Did you verify that the problem was "real"? The example does not seem to
> show enough. Can be just an experimentation of the general construction,
> with no specific application in mind. Some newbies do that. (In which
> case the 2002 decision should probably stand. Private types solve the
> general problem.)
Well, as the OP I can't really say how "real" the problem is. But I
can describe what it is I'm trying to accomplish.
What I'm trying to do is implement (in Ada) the ideas in the book
"Practical Statecharts in C/C++" by Miro Samek, CMP Books, 2002, ISBN
1-57820-110-1 <http://www.quantum-leaps.com/writings/book.htm>. The
(quite ingenious) idea is that the current state of a hierarchical
state machine can be represented by nothing more than a reference (a
function pointer in C++) to the state handling function. And to
implement the hierarchical aspect of statecharts, each state handling
function returns a reference to its parent state if it doesn't handle
the passed-in event itself.
Of course there are other ways of getting the required information
back from the state handler, but I am trying to keep the Ada
implementation similar to the original C++ implementation. At least
where it makes sense to do so. That's what started me exploring the
possibility of an access-to-function type being defined as returning a
value of its own type. I then stumbled across the inability to
convert my state handler functions to procedures. And that prompted
my original posting. I now see that my original access-to-function
type was erroneous and therefore so is my entire line of reasoning.
Oops!
Whether or not this situation justifies changing Ada is well beyond
me. I certainly wouldn't like to see this capability added just
because C++ can do it (besides, it's a hack in C++ anyway). But if
the Ada-Powers-That-Be decide that this capatility is worth adding to
Ada, I could certainly make use of it.
Thanks again,
Tad
next prev parent reply other threads:[~2003-11-05 22:54 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
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 [this message]
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