comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Generics vs. O-O?
Date: Fri, 2 Aug 2013 18:15:47 +0200
Date: 2013-08-02T18:15:47+02:00	[thread overview]
Message-ID: <16h8mgh7dbnqw$.13wra2b10eaya$.dlg@40tude.net> (raw)
In-Reply-To: 8bef1dc4-547b-478e-b81a-09077212f821@googlegroups.com

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


  parent reply	other threads:[~2013-08-02 16:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 14:45 Generics vs. O-O? Eryndlia Mavourneen
2013-08-01 19:24 ` Dmitry A. Kazakov
2013-08-01 19:52   ` Eryndlia Mavourneen
2013-08-01 20:14     ` sbelmont700
2013-08-01 23:35       ` Yannick Duchêne (Hibou57)
2013-08-01 20:10   ` optikos
2013-08-01 20:26     ` Dmitry A. Kazakov
2013-08-01 20:35     ` Jeffrey Carter
2013-08-01 21:22     ` Bill Findlay
2013-08-01 23:38     ` Yannick Duchêne (Hibou57)
2013-08-01 22:20   ` Georg Bauhaus
2013-08-02  8:11     ` Dmitry A. Kazakov
2013-08-02  9:50       ` Georg Bauhaus
2013-08-02 14:09         ` Dmitry A. Kazakov
2013-08-02 15:08           ` Shark8
2013-08-02 15:36             ` Alan Jump
2013-08-02 17:00               ` Jeffrey Carter
2013-08-02 17:51               ` Dmitry A. Kazakov
2013-08-02 18:06                 ` Alan Jump
2013-08-02 19:08                   ` Dmitry A. Kazakov
2013-08-02 16:15             ` Dmitry A. Kazakov [this message]
2013-08-03  0:04       ` Yannick Duchêne (Hibou57)
2013-08-03  7:35         ` Georg Bauhaus
2013-08-03  8:57           ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox