Should the SRFI mandate current-directory per thread? Lassi Kortela 30 Apr 2020 12:14 UTC

> I just checked what R7RS said about parameters.
>
>          If an implementation supports multiple threads of execution, then
>          parameterize must not change the associated values of any parameters in
>          any thread other than the current thread and threads created inside
>          ⟨body⟩.
>
> If I correctly understand, it means the use of `parameterize' implies a
> per-thread value (the effect of passing arguments to the procedure returned by
> `make-parameter', usually for "modification" isn't specified and is
> implementation dependent).
>
> So regarding (1), for consistency with parameter, the working-directory couldn't be
> a per-process value.
>
> And regarding (2), it is per-process value.

Thanks for looking this up - very useful!

It seems there can be several kinds of trouble if the current directory
is per-process in a multi-threaded implementation. To that end, I would
vote to require a per-thread cwd parameter unless there are compelling
arguments otherwise.

Simple Scheme implementations tend to be single-threaded so the whole
issue can be sidestepped there.