chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] egg announcement: remote-repl


From: John Cowan
Subject: Re: [Chicken-users] egg announcement: remote-repl
Date: Tue, 19 Aug 2008 10:02:26 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Jörg F. Wittenberger scripsit:

> To sum up: the approach feels not very clean to me.  It would be much
> more practical to add another argument to make-parameter and have it
> support all three parameter designs, wouldn't it?

It's actually easy to get thread-global parameters without any modifications
to Chicken using this procedure:

(define (make-global-parameter default)
  (let ((value default))
    (lambda maybe (if (null? maybe) value (set! value (car maybe))))))

What is returned looks like a parameter, quacks like a parameter,
and can be controlled with parameterize:

#;> (define p (make-global-parameter 32))
#;> (p)
32
#;> (p 33)
#;> (p)
33
#;> (parameterize ((p 45)) (p))
45
#;> (p)
33
#;> (parameterize ((p 45)) (error (p))
Error: 45

#;> (p)
33

-- 
Values of beeta will give rise to dom!          John Cowan
(5th/6th edition 'mv' said this if you tried    http://www.ccil.org/~cowan
to rename '.' or '..' entries; see              address@hidden
http://cm.bell-labs.com/cm/cs/who/dmr/odd.html)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]