public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Duncan Mak <duncanmak@gmail.com>
To: Per Bothner <per@bothner.com>
Cc: kawa mailing list <kawa@sourceware.org>
Subject: Re: How to set procedure name in macros
Date: Mon, 02 Jan 2017 02:54:00 -0000	[thread overview]
Message-ID: <CABgWrqrw+ZJy3Y8-biJQP0SaRue8HDxv9qc5vw8MFEkH5iWoEg@mail.gmail.com> (raw)
In-Reply-To: <CABgWrqquaOokf49gTzHD4VzZqqu-rf3LgkrP9j21_Phsy5Qpgg@mail.gmail.com>

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.

  reply	other threads:[~2017-01-02  2:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01 23:00 Duncan Mak
2017-01-02  0:37 ` Per Bothner
2017-01-02  2:51   ` Duncan Mak
2017-01-02  2:54     ` Duncan Mak [this message]
2017-01-02 14:17 ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABgWrqrw+ZJy3Y8-biJQP0SaRue8HDxv9qc5vw8MFEkH5iWoEg@mail.gmail.com \
    --to=duncanmak@gmail.com \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).