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!2.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.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: Tue, 11 Jul 2017 11:04:37 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Generators/coroutines in future Ada? Date: Tue, 11 Jul 2017 12:04:39 -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=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.68.176.30 X-Trace: sv3-iJup16h5WKGHBbQaseI4b3zt2apIhzgEc1uZ01zhnx8WDfB96uuiUZvh9+m2RqS9kwaX4dpB7r2eixK!u3/qhfWNg2hQz30GKap96JWKdYIAn5+6ZW0ZG6Sp4XGv5KhoOHuEv/sUZ46zZ4NdQ+DOCsuggJfg!SMjDKwvrvdx5aTFqMN/DBBlco2s= 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: 2268 Xref: news.eternal-september.org comp.lang.ada:47357 Date: 2017-07-11T12:04:39-04:00 List-Id: On Tue, 11 Jul 2017 15:26:49 +0200, "J-P. Rosen" declaimed the following: >Le 11/07/2017 à 15:01, Victor Porton a écrit : >> I've realized how to imitate closures with generics. >> >> But is there is a way to add generators to Ada? > >AFAIU, generators are functions with states, where the returned value at >one call depends on the state that was left behind by the previous call. >This can easily be achieved with a function within a package, where the >package serves to protect and hide the function's state. > Which description falls back to my first response in the thread -- using the standard random number generator as an example of a generic package... As I interpret the random number generator, it hides the state in a private type, instances of which need to be passed to the generator function(s) should one need to have multiple generators of the same nature. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/