[racket] Extending syntax-parameters?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Oct 17 01:54:50 EDT 2012

20 minutes ago, John Clements wrote:
> 
> On Oct 16, 2012, at 7:16 PM, Eli Barzilay wrote:
> 
> > So you need to grab it outside of the new tansformer, just like
> > with plain parameters and closures.
> 
> just like with plain parameters? that doesn't sound right to me:
> 
> #lang racket
> 
> (define p (make-parameter 3))
> 
> (parameterize ([p (+ 1 (p))])
>   (p ))
> 
> … produces 4.
> 
> That is, the rhs of the parameter-binding is not in the extent of
> the new binding.
> 
> Am I misunderstanding you?

Yes -- what I mean is that if you refer to the syntax parameter inside
of a new transformer, then that's equivalent to:

  (parameterize ([p (λ () ... (p) ...)])
    (p))

and the equivalent of my suggested solution is to make it into

  (let ([old-p (p)])
    (parameterize ([p (λ () ... (old-p) ...)])
      (p)))

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


Posted on the users mailing list.