Marko Rauhamaa <ma...@pacujo.net> writes: > Mark H Weaver <m...@netris.org>: > >> This is expected but not ideal. Our primitive evaluator does not >> preserve non-toplevel variable names, and therefore the associated >> procedure names are lost. Maybe we can fix this in Guile 2.2. > > I noticed the issue because I have software that depends on the > procedure-name of inner functions. I can live with this guile-2.0 quirk > if it is considered a guile defect.
Here's a simple workaround for now, though unfortunately it will mostly prevent our compiler from doing optimizations on code that uses this 'define' macro: (define-syntax define (syntax-rules () ((define (proc . args) body body* ...) (define proc (let ((p (lambda args body body* ...))) (set-procedure-property! p 'name 'proc) p))) ((define name expr) ((@ (guile) define) name expr)))) Does this work for you? Alternatively, you could make sure to always compile your code, in which case 'procedure-name' should work properly. Mark