[plt-scheme] let vs parameterize?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 16 20:14:42 EDT 2007

On Apr 16, Geoffrey S. Knauth wrote:
> On Apr 16, 2007, at 16:58, Robby Findler wrote:
> > I suggest that [YSC] read these two papers to get an idea of the
> > pragmatics of custodians:
> > http://www.ccs.neu.edu/scheme/pubs/icfp99-ffkf.pdf
> > http://www.cs.utah.edu/plt/publications/pldi04-ff.pdf
> 
> Great papers--they explain so much.  I was looking at the first, and  
> on page 5 saw this:
> 
> (parameterize ((current-custodian cust))
>    (parameterize ((current-eventspace (make-eventspace)))
>      (queue-callback graphical-tick-loop)))
> 
> and wondered why it wasn't in a different [imagined] style, say, like  
> this:
> 
> (parameterize* ((current-custodian cust)
>                  (current-eventspace (make-eventspace)))
>    (queue-callback graphical-tick-loop))
> 
> I looked and saw there's a parameterize* in sandbox.ss.

Usually there's no need for a `parameterize*'.  There are some tricky
situations though -- like the example in the handin-server: the thing
is that when you create an eventspace, a handler thread is created for
it, so if you use `parameterize' for both parameters, the handler
thread will still be created in the previous custodian.

(As for the `parameterize*' in handin-server -- there's several other
cases where parameter order matters.  I think that it's an uncommon
example where lots of parameters are set for setting up the the
sandboxed environment.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.