From: darkestkhan <darkestkhan@gmail.com>
Subject: Re: Generators/coroutines in future Ada?
Date: Tue, 11 Jul 2017 22:42:11 -0700 (PDT)
Date: 2017-07-11T22:42:11-07:00 [thread overview]
Message-ID: <0260f40d-0737-4d92-a2e3-bcada4cbcb20@googlegroups.com> (raw)
In-Reply-To: <ok26bp$lt4$1@dont-email.me>
On Tuesday, July 11, 2017 at 9:42:59 AM UTC, J-P. Rosen wrote:
> Le 10/07/2017 à 15:38, Victor Porton a écrit :
> > But AFAIK Ada does not support closures.
> >
> > Are closures really needed to implement generators?
> >
> > It is nearly impossible to add closures to Ada, right?
>
> Taking the example from Wikipedia:
>
> function startAt(x)
> function incrementBy(y)
> return x + y
> return incrementBy
>
> variable closure1 = startAt(1)
> variable closure2 = startAt(5)
>
> This could be written as:
> generic
> Start_Value : Integer
> function Increment_By (X : integer) return Integer;
>
> function Closure1 is new Increment_By (1);
> function Closure2 is new Increment_By (5);
>
> ----
> I can hear you saying that "generics are a poor man's workaround for the
> lack of closure", to which I respond that closures are a limited
> workaround for the lack of the more general concept of generic...
>
> TBH, I don't think there is any value in the kind of discussion that
> starts with "Language X is lacking feature A from language Y".
>
> Express a problem in language Y, let people provide their solution in
> language X, and then we can discuss the merits of each solution, given
> some quality criteria. Note that sometimes, criteria can be at odds;
> f.e., people nowadays value ease of writing and flexibility very much,
> but these are quite opposed to safety, readability, and long term
> maintenance which form the basic requirements of Ada.
>
> --
> J-P. Rosen
> Adalog
> 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
> Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
> http://www.adalog.fr
Other ways in which this can be done (beside generic package with state):
- task
- protected object
- additional argument of [tagged] limited type
Likely some other ways are possible. I just don't see what is the point of special construct for generators when we got at least 4 ways to do it.
next prev parent reply other threads:[~2017-07-12 5:42 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-09 20:19 Generators/coroutines in future Ada? Victor Porton
2017-07-09 21:28 ` Dennis Lee Bieber
2017-07-09 23:56 ` Victor Porton
2017-07-10 7:33 ` Dmitry A. Kazakov
2017-07-10 13:38 ` Victor Porton
2017-07-10 17:01 ` Paul Rubin
2017-07-10 21:24 ` Victor Porton
2017-07-12 17:09 ` Paul Rubin
2017-07-12 17:39 ` Victor Porton
2017-07-13 6:35 ` Paul Rubin
2017-07-11 9:42 ` J-P. Rosen
2017-07-11 12:52 ` Victor Porton
2017-07-11 13:01 ` Victor Porton
2017-07-11 13:26 ` J-P. Rosen
2017-07-11 16:04 ` Dennis Lee Bieber
2017-07-11 16:59 ` Dmitry A. Kazakov
2017-07-11 19:52 ` Pascal Obry
2017-07-11 20:18 ` Dmitry A. Kazakov
2017-07-11 18:36 ` Victor Porton
2017-07-11 19:22 ` J-P. Rosen
2017-07-11 20:25 ` Dmitry A. Kazakov
2017-07-11 23:19 ` Victor Porton
2017-07-12 4:54 ` J-P. Rosen
2017-07-12 13:07 ` Victor Porton
2017-07-12 13:38 ` Dmitry A. Kazakov
2017-07-12 5:35 ` Randy Brukardt
2017-07-12 7:27 ` Dmitry A. Kazakov
2017-07-12 22:47 ` Shark8
2017-07-16 13:11 ` Robert Eachus
2017-07-17 23:54 ` Randy Brukardt
2017-07-18 7:38 ` Dmitry A. Kazakov
2017-07-12 7:19 ` Dmitry A. Kazakov
2017-07-12 6:35 ` G.B.
2017-07-12 7:34 ` Dmitry A. Kazakov
2017-07-12 20:49 ` G.B.
2017-07-13 8:18 ` Dmitry A. Kazakov
2017-07-12 17:34 ` Paul Rubin
2017-07-11 19:27 ` Simon Wright
2017-07-12 5:42 ` darkestkhan [this message]
2017-07-12 8:57 ` Maciej Sobczak
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox