Hi,

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

> I recently tried to implement reader directives, e.g.:
>
>   #!fold-case     (from R7RS)
>   #!no-fold-case  (from R7RS)
>   #!curly-infix   (from SRFI-105)
>
> However, I ran into a rather serious problem.  Guile's reader options
> are global to the entire process, but clearly these reader directives
> should affect only the port they are read from.  So we need to support
> per-port reader options.

I think we should instead be able to instantiate new readers–i.e., have
a higher-order ‘make-reader’ procedure (that’s how Guile-Reader started,
actually.)

That, combined with the ‘current-reader’ fluid, should provide good
flexibility.

As an example,
http://git.savannah.gnu.org/cgit/guile-reader.git/tree/modules/system/reader/confinement.scm
provides reader settings that are confined for each module.

Also, I think ports should remain reader-oblivious.  ‘read’ is
fundamentally at a higher level of abstraction, so I’d personally prefer
not to have ports fiddle with it.

WDYT?

Thanks,
Ludo’.


Reply via email to