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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!195.71.90.67.MISMATCH!news.unit0.net!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Tagged type more type safe than access to subprogram ? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <336a4300-9867-4caf-a8c2-4e75e262e694@l13g2000yqb.googlegroups.com> <1hw5s0lijncfx$.ts4hox0vmab3.dlg@40tude.net> <4ae9fece$0$6590$9b4e6d93@newsspool3.arcor-online.net> Date: Fri, 30 Oct 2009 09:25:12 +0100 Message-ID: <1u5tn3ocre9xa.mp0ga48bvhg9.dlg@40tude.net> NNTP-Posting-Date: 30 Oct 2009 09:25:09 CET NNTP-Posting-Host: b3c8110b.newsspool4.arcor-online.net X-Trace: DXC=__MZPlmM8`C=8m7nZkdN^@4IUKO4?>HAgI5k4E X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8878 Date: 2009-10-30T09:25:09+01:00 List-Id: On Thu, 29 Oct 2009 21:45:02 +0100, Georg Bauhaus wrote: > Dmitry A. Kazakov schrieb: >> On Thu, 29 Oct 2009 04:00:29 -0700 (PDT), Hibou57 (Yannick Duchêne) wrote: >> >>> On 28 oct, 09:55, "Dmitry A. Kazakov" >>> wrote: >>>> An access to subprogram is a poor-man's closure. Let's ignore "access" part >>>> and consider a pure downward closure (as it should have been in Ada). >> >>> “ As this should have been in Ada ” ? What were you to mean ? I've >>> always though real closures are not possible with such structures as >>> Ada provides, except at package level — which is especially the case >>> when a package can have multiple instances... but only at package >>> level. Isn't it ? >> >> I meant downward closures. [...] > >> BTW, in Ada 83, there waa no access to subprogram, so we used tasks instead >> (where a subprogram had to be a non-generic parameter). > > Tagged types may come close to a solution sometimes. Yes, I am using this pattern very often. But: 1. There were no tagged types in Ada 83 2. In Ada 95 tagged types were in effect strictly library-level. This restriction was lifted only in Ada 2005, too late to stop the "access-to everything cancer". 3. The language is too heavy when it comes to create a singleton object overriding one or two abstract primitive operations. There should be short-cuts for that. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de