[plt-scheme] preserving the lack of an inferred name

From: Doug Orleans (dougo at place.org)
Date: Fri Jun 18 18:32:11 EDT 2004

I can preserve a procedure's inferred name in a macro:

(define-syntax (keep-name stx)
  (syntax-case stx ()
    ((_ x)
     (with-syntax ((x (syntax-property #'x 'inferred-name (syntax-local-name))))
       (syntax/loc stx
         (let ((foo x))
	   (display (object-name foo))

  > (define x (keep-name (lambda () 1)))

The problem is if there is no inferred name, i.e. `syntax-local-name'
returns #f, the procedure will be named `foo':

  > (keep-name (lambda () 1))

Is there a way to keep the procedure unnamed, so that a name will be
constructed from its location like usual?

  > (lambda () 1)

--dougo at place.org

Posted on the users mailing list.