On Tuesday, October 13, 2015 at 11:40:12 PM UTC, Alexis King wrote:
> Have you taken a look at parameters?
Short answer: yes. Long answer: they're convenient thread-local globals, but 
still feel like globals to me.

(define a (make-parameter 0))

(define (called-at-hopefully-regular-intervals)
  (a (+ (a) 1))

(define (something-stupid)
  (let ((b (a)))
    (totally-innocuous-event-loop)
    (+ 3 b b b)))

A local variable session doesn't require me to for the internal implementation, 
write a bunch of abstraction-rich difficult-to-optimize inscrutable state code, 
whereas with parameters I always have to (call) them just in case their value 
just changed.

It's like parameters force the internal stuff to use the careful, externally 
exposed interface to access their own internal data.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to