This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to set procedure name in macros


Oh sorry, I sent prematurely, define-d does work in Kawa 2.2.

Thanks!

On Sun, Jan 1, 2017 at 9:49 PM, Duncan Mak <duncanmak@gmail.com> wrote:
> Hello Per,
>
> I'm running the Kawa 2.2 release jars and define-d didn't work for me.
> It still says 'foo'.
>
> Perhaps it's a fix that hasn't made it to a released build?
>
> Looking forward to Kawa 2.3 ;-)
>
>
>
> Duncan.
>
> On Sun, Jan 1, 2017 at 7:37 PM, Per Bothner <per@bothner.com> wrote:
>>
>>
>> On 01/01/2017 02:59 PM, Duncan Mak wrote:
>>>
>>> Hello all,
>>>
>>> Happy new year!
>>>
>>> In my DEFINE-FOO macro and I noticed that I can't control the name of
>>> the lambda in the syntax expansion.
>>
>>
>> This works:
>>
>> (define-syntax define-d
>>   (lambda (stx)
>>     (syntax-case stx ()
>>       ((_ n) #`(define n (letrec ((foo (lambda () #f)))
>>                                  (set-procedure-property! foo 'name 'n)
>>                                  foo))))))
>>
>> First, you needs to quite the property value.
>> Secondly, you should not use the same identifier for the syntax parameter
>> as the name" keyword.
>>
>> I'm not clear why the following doesn't work - I'm looking into it.
>>
>> (define-syntax define-c
>>   (lambda (stx)
>>     (syntax-case stx ()
>>       ((_ n) #`(define n (letrec ((foo (lambda () name: 'n
>>                                                #f)))
>>                            foo))))))
>>
>> --
>>         --Per Bothner
>> per@bothner.com   http://per.bothner.com/
>
>
>
> --
> Duncan.



-- 
Duncan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]