This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thread local readtables


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]