Hello!

Mark H Weaver <m...@netris.org> skribis:

> The problem with the approach above is that it sets the read options
> globally, which is obviously a bad idea in a multithreaded program.
>
> Until very recently there was no other practical option, but now 'read'
> starts by building a private struct 'scm_t_read_opts' and passes it down
> to all the helper functions explicitly. 

Yep, it’s good to see that this work is already beneficial to other
areas.  :-)

> I've been avoiding adding a public API for this, because I feel that the
> current 'read-options' API is poorly-designed and I'd rather take the
> opportunity to come up with a clean design.

What about just mapping the existing ‘read-options’ to something like:

  (set-port-read-options! PORT OPTIONS)

where OPTIONS would be a list of symbols, as for ‘read-options’?  This
seems to me like the obvious API extension, but maybe I’m overlooking
something.

> For now, I suggest that we add 'get-datum' as a C function in read.c,
> which initializes the 'scm_t_read_opts' as needed for R6RS.

Yes, there’s still this possibility if the above one doesn’t work.

Thanks,
Ludo’.


Reply via email to