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-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: in defense of GC References: <1169531612.200010.153120@38g2000cwa.googlegroups.com> <1mahvxskejxe1$.tx7bjdqyo2oj$.dlg@40tude.net> <2tfy9vgph3.fsf@hod.lan.m-e-leypold.de> <1g7m33bys8v4p.6p9cpsh3k031$.dlg@40tude.net> <14hm72xd3b0bq$.axktv523vay8$.dlg@40tude.net> <4zwt33xm4b.fsf@hod.lan.m-e-leypold.de> <1j7neot6h1udi$.14vp2aos6z9l8.dlg@40tude.net> <1pzx3y7d2pide.y744copm0ejb$.dlg@40tude.net> <1aqj1657qjei9.1umdok28t0trz$.dlg@40tude.net> From: Markus E Leypold Organization: N/A Date: Sun, 04 Feb 2007 23:47:29 +0100 Message-ID: User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:wpE2ODvZvwhPv4ZnMSfU1PcGkl0= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.198.57 X-Trace: news.arcor-ip.de 1170628948 88.72.198.57 (4 Feb 2007 23:42:28 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-lond.gip.net!news.gsl.net!gip.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:8940 Date: 2007-02-04T23:47:29+01:00 List-Id: "Dmitry A. Kazakov" writes: >> >> Yes. That is exactly what I referred to in earlier posts as clumsy -- >> to replace closure by this kind of dance. > > Do you refer to the first variant or to the second? The "closure free solution" (I'm not quoting it again -- it's long enough as it is). > Doesn't it solve the problem? Perhaps. This (and some other stuff) >> type function Stepper (F : Foo) return Foo; >> -- The type of a function we want to pass somewhere >> procedure Step_It (Visitor : Stepper'Class); >> ... doesn't look like Ada to me. So I assume, you're still proposing language extensions. With unclear semantics to me. And perhaps they alow you to do what you want: But so complicated, well ... You can do that in FORTRAN and too: With even less comprehensibility. > Note that in your solution you were unable to > describe what function Make_a_Stepper actually returns. Since there is no closure type, presently. But if you like, add a language extension: type stepper_t is procedure ( I : Integer ) return Integer; and the fill in this type. > Consider also this: > > protected type Bar is > function Make_a_Mess return ...; > private > Baz : Integer; > -- To be put into the closure together with barriers of the entries! > > how do you return a closure from a protected object or a task rendezvous? > Will it be able to assign Baz? Interesting thought. Either it must inherit the barriers, somehow, or you simply can't. > I certainly prefer OO solution because it explicitly maintains the context > of the operation. It is easier to understand for the reader and it easier > to maintain. My mileage varies. >>>> If it works, we have closures. If it doesn't I fail to see what you >>>> mean by 'returning procedures'. >>> >>> Hmm, it must be obvious. How could it be so that we have >>> access-to-procedure types, but no procedure types? >> >> ?? I still do not understand. If memory serves me right, I cannot >> return an access to a local procedure. So? > I merely explained why I consider procedural types necessary. Well -- I think your addition is not worth the effort, but YMMV. I still do not see, how you would manage to pass procedure upwards which us variables that are defined in their environment. > Accessibility checks are needed for both them and access to > procedure. Though for procedural values they will be much > weaker. Downward closures would require no checks at all. Just write an addendum to the ARM. Perhaps we'll find it in Ada 2020. But somehow I doubt it. Regards -- Markus