[plt-scheme] Re: Style question

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jun 3 15:12:06 EDT 2009

On Jun  3, Ryan Culpepper wrote:
> It permits the new name to be determined at run time, and that makes
> it more useful, but that doesn't mean that it's a bad thing to use
> it when the name is statically known. It seems reasonable to prefer
> 'procedure-rename' to some contortion of bindings designed to drop
> the right name on the right lambda form.

(Another possible problem here is that there is currently an overhead
for functions that are renamed that way.)

> I think we should just make 'procedure-rename' (as exported from
> scheme/base, anyway) handle keyword procedures.

I completely agree.

> That's a bad idea if the procedure's body needs to refer to the
> outer binding of the name you want to give it.
> [...]
> Only use let to do procedure renaming.

Yes, sorry.  (I was trying to make it "look nicer".)

Tomasz, in case you tried to use the macro I wrote and found that it's
broken -- this is how it should be implemented instead:

  (define-syntax-rule (define/provide (external-name . args)
                        body ...)
      (define hidden-name
        (let ([external-name (lambda args body ...)])
      (provide (rename-out [hidden-name external-name]))))

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

Posted on the users mailing list.