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              [EMAIL PROTECTED]
http://cm.bell-labs.com/cm/cs/who/dmr/odd.html)


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to