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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-18 10:14:12 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters Date: 18 Dec 2003 13:14:11 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: pip1-5.std.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1071771251 25841 192.74.137.185 (18 Dec 2003 18:14:11 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 18 Dec 2003 18:14:11 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:3537 Date: 2003-12-18T13:14:11-05:00 List-Id: "Dmitry A. Kazakov" writes: > Robert A Duff wrote: > > > I'm still pushing for downward closures to be added to the language, > > which would add at least a minimal amount of support for iterators, > > and greatly simplify this and other data-structure proposals. > > Wouldn't subroutine types do the trick? I wonder why Ada does not have them. By "downward closures", I mean the ability to pass more-nested procedures as parameters to less-nested procedures. If that's what you mean by "subroutine types", then yes. Access-to-subprogram types don't do the trick because of the accessibility rules. Hence the extra "context" parameters in Jeff Carter's iterators. I also would like the ability to have anonymous procedures, like lambda in Lisp, or blocks in Smalltalk. The idea is to pass the body of a loop as a parameter to the iterator, and I don't want to have to give a *name* to every loop body, and I want to write it *inside* the loop (i.e. inside the call to the iterator). I also want the ability to jump out of those anonymous procedures, to exit the loop, without passing extra parameters around. The extra parameter is bad because it forces loops that *don't* want to exit prematurely to worry about whether they might want to exit prematurely. I don't expect to see any of this in Ada, ever, except perhaps for downward closures. There is an AI on downward closures, but I don't remember it's status. I hope it gets in. It's the only case where Ada is inferior in power to Pascal. - Bob