New draft (#2) of SRFI 226: Control Features Arthur A. Gleckler (10 Sep 2022 01:26 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (30 Sep 2022 07:32 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (30 Sep 2022 19:15 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (30 Sep 2022 20:08 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (30 Sep 2022 21:22 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (01 Oct 2022 13:14 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (01 Oct 2022 18:56 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (01 Oct 2022 21:10 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (03 Oct 2022 11:39 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (03 Oct 2022 13:21 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (03 Oct 2022 14:59 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (07 Oct 2022 16:22 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (07 Oct 2022 21:36 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (08 Oct 2022 00:13 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (09 Oct 2022 16:07 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (09 Oct 2022 20:30 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (10 Oct 2022 06:26 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (10 Oct 2022 16:48 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (12 Oct 2022 06:27 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (13 Oct 2022 00:02 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (13 Oct 2022 06:40 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (13 Oct 2022 15:31 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (13 Oct 2022 15:51 UTC)
Re: New draft (#2) of SRFI 226: Control Features Arthur A. Gleckler (30 Sep 2022 23:35 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (27 Oct 2022 06:01 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Feeley (29 Oct 2022 02:54 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (29 Oct 2022 08:13 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Feeley (29 Oct 2022 12:49 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (29 Oct 2022 13:49 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (29 Oct 2022 18:49 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (03 Nov 2022 17:02 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (04 Nov 2022 19:54 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (29 Oct 2022 15:38 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (29 Oct 2022 16:31 UTC)
Re: New draft (#2) of SRFI 226: Control Features John Cowan (29 Oct 2022 21:52 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (30 Oct 2022 08:35 UTC)
Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen (28 Oct 2022 15:17 UTC)

Re: New draft (#2) of SRFI 226: Control Features Marc Nieper-Wißkirchen 01 Oct 2022 21:10 UTC

Am Sa., 1. Okt. 2022 um 20:56 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
>
>
> On Sat, Oct 1, 2022 at 9:14 AM Marc Nieper-Wißkirchen <xxxxxx@gmail.com> wrote:
>
>>
>> (define-syntax unwind-protect
>>   (syntax-rules ()
>>     ((unwind-protect protected-form cleanup-form)
>>      (call-with-continuation-barrier
>>        (lambda ()
>>          (dynamic-wind
>>            (lambda () (values))
>>            (lambda () protected-form)
>>            (lambda () cleanup-form)))))))
>>
>> Is this close to what you have in mind?
>
>
> LGTM, though I have not checked to see how well it matches the (single-threaded) CLHS definition.  There is a de facto standardization of OS threads for CL, but none for green threads that I can find.

Let's keep this open for a few days. If we add `unwind-protect` to the
Scheme language, we should get it right.

>
>> If I were to design my own iterator protocol, I would make the iterator procedure take two continuation procedures, a success procedure that would be invoked on the iterator's tail and the next value, and a failure thunk.  This is the most direct translation from the abstract iterator semantics.  All other protocols can be simply derived:
>
>
> Nice.  I hope to see a SRFI of this type.

Noted.

>>
>> Make `&thread` inherit from `&serious`, not `&error`, and raise some conditions continuably.
>>
>> What do you think?
>
>
> Well, it's always up to the raiser whether to use raise or raise-continuably, not the definer of conditions.  But it would be fair enough to advertise that this is a supported thing to do.

Here, these conditions are usually raised by the thread system. I
meant whether the thread system should raise them continuably. I think
this makes sense.

>>
>> I don't see this as a problem.  More than one thread-runner would wait for the same thread to terminate, which would pose no problem.
>
> Okay.
>
>>>>
>>>> (This works well because the creation and the start of threads are separated.)  When the thread runner is called with no argument, we could make it unregister and return an arbitrary thread it holds.
>>>
>>>
>>> This defeats the scoping for which thread-runners were devised.  However, the concerns could be separated by providing (register-thread thread-runner thread), which fails if the thread is already registered, as well as (with-thread-runner proc).
>>
>>
>> I don't see a problem here, but maybe I don't understand.
>
>
> I think we are talking past one another.  You are describing a lower-level construct, which is good in itself, that I would call a thread-holder: it holds threads and allows you to wait until an arbitrary thread completes.  But a thread-runner is intended as an object for *structuring* concurrent computation.  I recommend <https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/#go-statement-considered-harmful> (the earlier part of the paper is a rehash of "Go to considered harmful", which I assume you have read).

I will take a look. So far, I think that my amendment to your
suggestion can still support the high-level approach.

As an alternative, what about a `with-thread-runner` that takes a
procedure and calls it with a procedure that is just a substitute for
`make-thread`?  This way, the primitive `make-thread` neither has to
be modified:

(with-thread-runner
  (lambda (make-local-thread)
    (define t (make-local-thread thunk))
    ...))