comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Do people who use Ada also use ocaml or F#?
Date: Sat, 30 Oct 2010 17:12:44 +0300
Date: 2010-10-30T17:12:44+03:00	[thread overview]
Message-ID: <8j2nesF7crU1@mid.individual.net> (raw)
In-Reply-To: <op.vld224sbule2fv@garhos>

Yannick Duchêne (Hibou57) wrote:
> Le Sat, 30 Oct 2010 14:14:52 +0200, Florian Weimer <fw@deneb.enyo.de> a 
> écrit:
> 
>> * Yannick Duchêne (Hibou57):
>>
>>> Ada 2012 introduced something looking like coroutines with the yield
>>> function (formally, generators), which is a famous feature of
>>> functional  paradigm languages (gonna be great for kinds of streams of
>>> any kind of  data or iterators).
>>
>> Is this AI05-166? I don't see how this leads to generators.
> I will not believe I am the only one who expect to use it for that 
> purpose. This would be incredible.
> I like it for iterators and every thing which is close or less close to 
> streams in the large. I use to talk about “coroutine” here, while the 
> real coroutine is more than that. But I don't mind, as I was not 
> expecting more.
> 
> What I like with it, is that it allow clean separation of the behavior 
> and usage. You simply have one or more yield points, instead of 
> returning from a procedure or function and having ugly control structure 
> to go to the resume point when the function is invoked again. This allow 
> to give control where the control should be given : weither the method 
> is controlling or is controlled, you have the same algorithm in both 
> case, expressed the same way. Otherwise, a simulation of Yield simply 
> make every thing less clear, as half of what you write is dedicated to 
> this Yield simulation.

I hesitate to say so, Yannick, but what you say above makes we wonder if 
you really know what sort of "yield" is proposed for Ada 2012. As I 
understand the proposed Ada 2012 Yield procedures, they are meant for 
low-level control of task scheduling, not as an "incremental" return 
statement that returns an element in an stream, for which the name 
"yield" is sometimes used in other languages and, in particular, for 
iterator-like operations.

A call of the Ada 2010 Yield is simply a dispatching point at which the 
running (calling) task is put back into the "ready" queue(s) and a new 
(or the same) task is chosen for running.

You can, of course, use Ada tasks to build the equivalent of coroutines, 
but you must then use inter-task communication methods (rendez-vous or 
protected objects) to transfer data between the tasks that simulate 
coroutines. You can do this without using the new Yield procedures, in 
which case normal Ada task scheduling interleaves the tasks/coroutines. 
The new Yield procedures would only help you to enforce a task switch 
when it would not necessarily occur automatically -- for example, 
between ready tasks of equal priority.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  parent reply	other threads:[~2010-10-30 14:12 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29  2:27 Do people who use Ada also use ocaml or F#? Chad  R. Meiners
2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
2010-10-30  1:32   ` Chad  R. Meiners
2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
2010-10-30  3:44       ` Chad  R. Meiners
2010-10-30 12:15     ` Georg Bauhaus
2010-10-30 12:14   ` Florian Weimer
2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
2010-10-30 13:59       ` Florian Weimer
2010-10-30 14:12       ` Niklas Holsti [this message]
2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
2010-10-30 19:20           ` Georg Bauhaus
2010-10-30 23:11           ` Jeffrey Carter
2010-10-31 15:13             ` Florian Weimer
2010-10-29  7:53 ` Dmitry A. Kazakov
2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
2010-10-29 19:10     ` Dmitry A. Kazakov
2010-10-29 22:16   ` Jeffrey Carter
2010-10-30  0:01     ` Vinzent Hoefler
2010-10-30  2:07       ` Chad  R. Meiners
2010-10-30 23:02         ` Jeffrey Carter
2010-10-30 23:30           ` Yannick Duchêne (Hibou57)
2010-10-31  2:31             ` Jeffrey Carter
2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
2010-10-31 10:57                 ` J-P. Rosen
2010-10-31 11:04                   ` Yannick Duchêne (Hibou57)
2010-10-31 16:58                 ` Jeffrey Carter
2010-11-01 17:46                 ` Colin Paul Gloster
2010-11-01 17:03                   ` Vinzent Hoefler
2010-11-03 13:30                     ` Colin Paul Gloster
2010-11-03 19:16                       ` Yannick Duchêne (Hibou57)
2010-10-30  7:41     ` Dmitry A. Kazakov
2010-10-30 23:08       ` Jeffrey Carter
2010-10-30 23:15         ` Vinzent Hoefler
2010-10-31  2:36           ` Jeffrey Carter
2010-10-31  3:01             ` Yannick Duchêne (Hibou57)
2010-10-31  4:52               ` Jeffrey Carter
2010-10-31  5:12                 ` Yannick Duchêne (Hibou57)
2010-10-31  7:38         ` Dmitry A. Kazakov
2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
2010-10-31  8:14             ` Dmitry A. Kazakov
2010-10-31 11:00           ` J-P. Rosen
2010-10-31 11:17             ` Dmitry A. Kazakov
2010-10-31 12:51               ` J-P. Rosen
2010-10-31 15:07                 ` Dmitry A. Kazakov
2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
2010-10-31 20:00                     ` Dmitry A. Kazakov
2010-10-31 20:04                       ` Yannick Duchêne (Hibou57)
2010-10-31 20:19                         ` Dmitry A. Kazakov
2010-10-31 18:23                   ` Jeffrey Carter
2010-10-31 18:02           ` Jeffrey Carter
2010-10-30  2:07   ` Chad  R. Meiners
2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
2010-10-30  3:55       ` Chad  R. Meiners
2010-10-30  7:49     ` Dmitry A. Kazakov
2010-10-30 12:18   ` Florian Weimer
2010-10-30 12:59     ` Dmitry A. Kazakov
2010-10-30 19:12       ` Yannick Duchêne (Hibou57)
2010-10-30 19:37         ` Dmitry A. Kazakov
2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
2010-10-30 20:54             ` Dmitry A. Kazakov
2010-10-30 21:53               ` Yannick Duchêne (Hibou57)
2010-10-31  8:12                 ` Dmitry A. Kazakov
2010-10-31  9:49                   ` Yannick Duchêne (Hibou57)
2010-10-31 21:46           ` Shark8
2010-11-01  9:32             ` Dmitry A. Kazakov
2010-11-01 10:17               ` Florian Weimer
2010-11-05 12:46               ` Robert A Duff
2010-11-05 16:39                 ` Dmitry A. Kazakov
2010-11-06 17:22                 ` Stephen Leake
2010-11-06 20:56                   ` Robert A Duff
2010-11-06 23:03                     ` Dmitry A. Kazakov
2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
2010-11-07  0:18                       ` Yannick Duchêne (Hibou57)
2010-11-07 11:51                       ` Simon Wright
2010-11-07 12:14                         ` Dmitry A. Kazakov
2010-11-07  3:05                   ` Chad  R. Meiners
2010-11-01 11:44             ` Brian Drummond
replies disabled

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