This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Thread local readtables
- From: Per Bothner <per at bothner dot com>
- To: Helmut Eller <eller dot helmut at gmail dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Thu, 20 Mar 2008 09:49:44 -0700
- Subject: Re: Thread local readtables
- References: <m28x0dehst.fsf@gmail.com>
Helmut Eller wrote:
I'd like to use different readtables in different threads.
Is there a recommended way to do that?
As far as I know, it should just work.
I tried gnu.kawa.lispexpr.ReadTable:setCurrent, but that seems to set
the global binding.
No, it sets the thread-local binding: It calls current.set(rt),
where current is a "ThreadLocation".
We could easily generalize (current-readtable) (see
gnu/kawa/slib/readtable.scm) to a "parameter", if that
would be useful:
(define-alias-parameter current-readtable <read-table>
(static-field <readtable> 'current))
using define-alias-parameter as defined in ports.scm.
OTOH it seems like incremental readtable modification
is more useful.
> It would nice if READ would take the readtable as
(optional) argument, instead of repeatedly calling
gnu.kawa.lispexpr.ReadTable:getCurrent.
We do pass the ReadTable as a parameter to some of the internal
routines, though I'm sure we can do better. Passing it to the
Scheme read routine is trickier. Whether it's worthwhile
depends on whether it uses significant time in big picture.
Does it?
My long-term goal is a nice integrated composable parser
framework. Haven't figured that one out yet ...
--
--Per Bothner
per@bothner.com http://per.bothner.com/