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-05 14:54:29 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: 5 Nov 2003 14:54:29 -0800 Organization: http://groups.google.com Message-ID: References: <80teqv099lspc5d4osf2gmu7cld46i0lvb@4ax.com> <20chqvglnrae8njr0011cfg3a8hc82je7m@4ax.com> NNTP-Posting-Host: 134.253.26.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1068072869 20468 127.0.0.1 (5 Nov 2003 22:54:29 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 5 Nov 2003 22:54:29 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:2111 Date: 2003-11-05T14:54:29-08:00 List-Id: Marius Amado Alves wrote in message news:... > 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 . 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