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 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Generics vs. O-O? Date: Fri, 2 Aug 2013 18:15:47 +0200 Organization: cbb software GmbH Message-ID: <16h8mgh7dbnqw$.13wra2b10eaya$.dlg@40tude.net> References: <6238c325-79c5-4537-ba55-2800110dc6df@googlegroups.com> <1wugpqyea6s39$.e2e8eshup5wn$.dlg@40tude.net> <51fadf40$0$6557$9b4e6d93@newsspool4.arcor-online.net> <15qso6tlt3uf1.h45wqc019b00$.dlg@40tude.net> <51fb80d8$0$6561$9b4e6d93@newsspool4.arcor-online.net> <1so729qnkrrj2.ztrxvmlw6cb7.dlg@40tude.net> <8bef1dc4-547b-478e-b81a-09077212f821@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: q/ev1P9zCVSwu+vpMGX5Tw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2562 Xref: number.nntp.dca.giganews.com comp.lang.ada:182816 Date: 2013-08-02T18:15:47+02:00 List-Id: On Fri, 2 Aug 2013 08:08:38 -0700 (PDT), Shark8 wrote: > On Friday, August 2, 2013 8:09:46 AM UTC-6, Dmitry A. Kazakov wrote: >> >>> For example, if >>> you'd want a callback to be passed somewhere. Then, dismissing generics >>> might entail the introduction of one level of indirection (subprogram >>> pointer), >> >> There is no need in using pointers in order to achieve downward closures. >> It was a kludge of Ada 95 design. Generics is a kludge of Ada 83 design. > > No, it was a well thought-out and justified feature; see the Ada83 rationale: Generics were fashionable back in 80's. We are 30 years older and hopefully wiser. >> Yet another language design >> problem that there is no simple way to declare such singleton types in Ada. > > Really? [...] > Type K sure looks like a singleton to me. I mean singleton types vs. closures. It is type Visitor_Interface is limited interface; procedure Meet (State : in out Visitor_Interface; Item : Element'Class) is abstract; procedure Enumerate ( Collection : Container; Visitor : in out Visitor_Interface'Class); vs. procedure Enumerate ( Collection : Container; Action : not null access procedure (Item : Element'Class); There is no need to be it really a singleton either for the object or for the closure. Just it is the most common case in practice. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de