comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: Generators/coroutines in future Ada?
Date: Sun, 09 Jul 2017 17:28:36 -0400
Date: 2017-07-09T17:28:36-04:00	[thread overview]
Message-ID: <eo65mc57j9ggrpb7o41hedh60rcs4hb5r2@4ax.com> (raw)
In-Reply-To: oju353$b75$1@gioia.aioe.org

On Sun, 09 Jul 2017 23:19:23 +0300, Victor Porton <porton@narod.ru>
declaimed the following:

>Is it possible to implement generators and coroutines (like as in Python) in 
>a future version of Ada?
>
>I am not an expert on how generators are implemented. Is it possible in a 
>language like Ada?
>

	Generators -- not as you think of them (ad hoc, on-demand, creation).
cf:
http://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-5-2.html
(which is focused on random number generation, but basically anything could
follow the schema). You'd have to define a (generic) package with a
generator type definition, and methods to manipulate state of the
generator. The instances of the generator type are what holds the state
between invocations.

>Well, I think it could add additional reliability, because programming of 
>processing of different "streams" becomes easier and thus less error prone.

	I wouldn't hold out much hope for coroutines. Ada was created from the
start with the concept of independent tasking (all the way back before
1980!). Formal co-routines (a la Modula-2) do not fit the philosophy as
they are a cooperative "task" switch (in classic co-routines, each routine
determines when it will transfer control to another, and possibly where in
that other transfer goes to -- it was even doable in FORTRAN-IV when
statement labels could be passed in/out of a call). I've never studied the
Python "co-routine" but it does not map to what I consider a co-routine.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

  reply	other threads:[~2017-07-09 21:28 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 [this message]
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
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