This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
implemented srfi-39: parameter objects
- From: Per Bothner <per at bothner dot com>
- To: kawa at sources dot redhat dot com
- Date: Sat, 12 Feb 2005 18:40:59 -0800
- Subject: implemented srfi-39: parameter objects
I checked into CVS an implementation of SRFI-39 "parameter
objects". In Kawa threads inherit bindings (as in Gambit-C),
the way fluid variables have also worked.
Basically a parameter object is an "anonymous fluid variable".
In fact you can do:
(define param (make-parameter))
(define-alias var (param))
Then:
(fluid-let ((var val)) body)
and
(parameterize ((param val)) body)
are equivalent. (At least that's how it's supposed to be!)
This was done as part of a re-vamping of fluid variables to
work more robustly (if a bit less efficiently) in the
presense of multiple threads/futures.
Another reason for parameter objects is to control various
options such as for printing. Common Lisp has dynamic variables
like *print-pretty* but hard-wiring in Common Lisp variable
names into language-independent libraries would be wrong. Instead,
we create a parameter object (speaking loosely), and define a
language-specific variable such as *print-pretty* to be an
alias for the parameter object.
--
--Per Bothner
per@bothner.com http://per.bothner.com/