[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile 2.0 interpretation vs compilation
From: |
Mark H Weaver |
Subject: |
Re: Guile 2.0 interpretation vs compilation |
Date: |
Mon, 06 Oct 2014 03:58:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Marko Rauhamaa <address@hidden> writes:
> Mark H Weaver <address@hidden>:
>
>> 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