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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!1.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 09 Jul 2017 16:28:36 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Generators/coroutines in future Ada? Date: Sun, 09 Jul 2017 17:28:36 -0400 Organization: IISS Elusive Unicorn Message-ID: References: User-Agent: ForteAgent/8.00.32.1272 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.68.177.140 X-Trace: sv3-g2FpuXoe9JctxHKLqSjF3tP+LpB+fLXQ2m+pARYrz86GorFbySCFL6e4L8bkxgXrPkZB/vZR3Gkb9Xq!R7HVHhWMIqdzsyWF8hxo8fB61PAGP4mZ5BqPN+zXQA+npRzT1E5LRQbky3A286rQjWxtkr2TcKKb!jyJ5P5lgS0ChEqC7JBHTVfVdpVmf X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2722 Xref: news.eternal-september.org comp.lang.ada:47333 Date: 2017-07-09T17:28:36-04:00 List-Id: On Sun, 09 Jul 2017 23:19:23 +0300, Victor Porton 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/