Open fare opened 4 years ago
My workaround:
;; In rec, the name is bound in the body of the lambda
(defrule (rec (name . formals) body ...)
(let () (def (name . formals) body ...) name))
;; In fn, the name is NOT bound in the body of the lambda
(defsyntax (fun stx)
(syntax-case stx ()
((_ (name . formals) body ...)
(with-syntax ((n (datum->syntax #'stx (string->uninterned-symbol (symbol->string (syntax-e #'name))))))
#'(let () (def (n . formals) body ...) n)))))
I am not convinced this can work reliably, only top-level procedures have names in gambit afaik.
For debugging purposes, it would be nice if
(let (foo (lambda (x) x)) ...)
would create a function for which##procedure-name
would returnfoo
rather than#f
.See how they do it in Racket: https://docs.racket-lang.org/reference/syntax-model.html#%28part._infernames%29