unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Needed: per-port reader options
@ 2012-10-13 18:51 Mark H Weaver
  2012-10-16 15:52 ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Mark H Weaver @ 2012-10-13 18:51 UTC (permalink / raw)
  To: guile-devel

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.

Unfortunately, our entire 'scm_t_port' structure is apparently part of
our public API and thus cannot be changed in 2.0.x.  Therefore, if we
hope to support either R7RS or SRFI-105 in 2.0.x, then I guess the only
option is to make a global weak key hash table, mapping ports to a table
of reader option overrides (and perhaps anything else we want to add to
the 'scm_t_port' structure).

Of course this global hash table must be protected by a mutex, which
will mean additional overhead for every 'read'.

I hope that we can make 'scm_t_port' private in Guile 2.2, and thus
restore our freedom to modify its structure.  Should we add deprecation
warnings in Guile 2.0 for applications that make direct use of this
structure?  Any ideas how to accomplish that?

What do you think?

    Mark



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-21 21:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-13 18:51 Needed: per-port reader options Mark H Weaver
2012-10-16 15:52 ` Ludovic Courtès
2012-10-16 20:22   ` Mark H Weaver
2012-10-16 21:39     ` Ludovic Courtès
2012-10-16 21:57       ` Noah Lavine
2012-10-16 22:01         ` Ludovic Courtès
2012-10-17  3:34       ` Mark H Weaver
2012-10-18 16:20         ` Ludovic Courtès
2012-10-18 17:48           ` Mark H Weaver
2012-10-19  2:12             ` Mark H Weaver
2012-10-21 21:40               ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).