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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: rogoff@sccm.Stanford.EDU (Brian Rogoff) Subject: Re: Q: access to subprogram Date: 1996/07/24 Message-ID: #1/1 X-Deja-AN: 170235072 references: <4rb9dp$qe6@news1.delphi.com> organization: /u/rogoff/.organization reply-to: rogoff@sccm.stanford.edu newsgroups: comp.lang.ada Date: 1996-07-24T00:00:00+00:00 List-Id: bobduff@world.std.com (Robert A Duff) writes: Brian Rogoff wrote: >.. I'm curious as to >whether you find Pascal style iterators using downward funargs (there, I'm >using Lisp terminology) superior to CLU/Sather-1.0 style iterators. No. When I was a Pascal programmer many years ago, I used procedures-as-params a lot for iterators. But CLU iterators are clearly superior. I don't know Sather, but from what I've read, they seem even more superior. Yes, Sather iterators are a pleasure to use. There is a paper on the web page about their design, and I imagine it has been published by now. On the other hand, their integration into Ada would have been rather major, whereas the Pascal approach would probably have been easier. >...And >how do the Ada 95 alternatives stack up? Not very well, I'm afraid. You can use generics, but you end up with a lot of verbose junk for some simple things. Sigh. Ada generics are great, but it seems that they are (over)used to hide certain ugly little corners of the language (like jgv's mutually recursive types fix). I don't like using them for this. >... Also, were these downward funargs >widely used, or was there a small set of problems in which they were the ideal >vehicle of expression, like the multidimensioal integration example? I'd say Pascal's downward "funargs" were widely used for iterators. At least in the code I saw, and the code I wrote. Anecdotal evidence, but useful. So when the feature was there, people used it a lot. Ada's generics can do *almost* everything that Pascal can do. They can't recurse, in Ada, like they can in Pascal. (I needed that once.) And they're verbose, as I said. Do you feel that they are the right solution though? The generic approach to function composition looked ugly to me, whereas the direct approach looks beautiful. That may be subjective, but I don't think so. I bet even most of the people who argued against this feature in Ada would admit that for this problem, generics are kind of ugly. Smalltalk's version is pretty nice, by the way. You don't pass procedures -- you pass blocks. And that avoids the annoyance of having to name something that doesn't need or deserve a name -- it's just the Body_Of_The_Loop, or whatever. Just like Scheme, which had anonymous and named lambda expressions. I suppose that in a future Ada, called Ada 0X rather than the plaintive sounding Ada 0Y, we could have anonymous downward funargs, as Richard O'Keefe suggested for Pascal. - Bob P.S. I was away for more than a week, so I may have missed some answers to my question about full closures. Did anybody answer that? Was this the "why are they any better than wrapping up the environment and func in a tagged type" question? -- Brian