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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99ab4bb580fc34cd X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: Q: access to subprogram Date: 1996/07/10 Message-ID: <4rvo07$bbl@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 167539964 references: <4rb9dp$qe6@news1.delphi.com> <4re2ng$t7u@wdl1.wdl.loral.com> <4rud55$5b0@fu-berlin.de> organization: Comp Sci, RMIT, Melbourne, Australia nntp-posting-user: ok newsgroups: comp.lang.ada Date: 1996-07-10T00:00:00+00:00 List-Id: bobduff@world.std.com (Robert A Duff) writes: >I agree -- it's not *that* big of a deal. But "just push the display on >the stack" is an operation that involves compile-time-unknown-sized >stuff, which is where the complexity comes from. Ah, but - if a procedure at lexical level N - directly encloses a procedure at lexical level N+1 - which is passed as a parameter all that has to be copied into the parent's activation record is D[1:N] whose size is known at compile time. The child (or the child's wrapper) needs to allocate space to hold the old values of D[1:N] when it is entered. >I was annoyed at that (about Modula-2) long before I joined the Ada 9X >project. I think the real story is that there are two totally different >features, and both are desirable: > 1. You can pass procedures around, and copy them willy-nilly, and > save them in global variables. This is "call backs". Pascal > does not have this feature. Modula-2 does, and Ada 95 does. Lisp, Scheme, ML, ... have this. > 2. You can pass procedures IN, and call them, but must never save > them in global variables. Pascal has this feature. Modula-2 > does not. Ada 95 does not, unless you count generic formal > subprograms, which support MOST of this, but not quite all, > and are overly verbose (IMHO). >Both of the above are desirable, but not at the same time. I'm not quite sure what "not at the same time means". If it means "not in the same language", I'd disagree. If it means "not in the same program", I wouldn't agree either. There's someone here doing a Masters thesis on adding support to Ada for a particular design pattern. I don't want to say too much, because he's just beginning implementation studies (what a wonderful thing GNAT is), but basically, callbacks are needed to do it right, and Ada's rules are a major headache. But the very programs that will benefit from this facility are also likely to abstract iteration as well, thus needing 1 and 2 in the same program. In Lisp, there would be no point in his thesis as the whole thing is not only utterly trivial, it is a well understood and long used technique. My PL/I is rather rusty, but I know rav reads c.l.a. Doesn't PL/I have procedure variables as well as procedure parameters? -- Fifty years of programming language research, and we end up with C++ ??? Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.