From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3713 invoked by alias); 2 Jan 2017 14:17:35 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 2779 invoked by uid 89); 2 Jan 2017 14:17:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 spammy=yours X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Jan 2017 14:17:24 +0000 Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1cO3QP-0004Gx-IB; Mon, 02 Jan 2017 15:17:21 +0100 Received: from 70-36-239-8.dsl.dynamic.fusionbroadband.com ([70.36.239.8] helo=localhost.localdomain) by mailfront10.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1cO3Pb-0007me-Rs; Mon, 02 Jan 2017 15:16:32 +0100 Subject: Re: How to set procedure name in macros To: Duncan Mak , kawa mailing list References: From: Per Bothner Message-ID: <82b7df05-4afd-2723-d8cc-82af0cafa35c@bothner.com> Date: Mon, 02 Jan 2017 14:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00005.txt.bz2 I checked in a fix for the following. I also checked in a testcase based on yours in testsuite/reflect-fname.scm. Thanks! 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. > > Here's a test case - > > (define-syntax define-a > (lambda (stx) > (syntax-case stx () > ((_ name) #`(define name (lambda () #f)))))) > > (define-syntax define-bar > (lambda (stx) > (syntax-case stx () > ((_ name) #`(define name (lambda () name: 'bar #f)))))) > > (define-syntax define-c > (lambda (stx) > (syntax-case stx () > ((_ name) #`(define name (letrec ((foo (lambda () name: name > #f))) foo)))))) > > (define-syntax define-d > (lambda (stx) > (syntax-case stx () > ((_ name) #`(define name (letrec ((foo (lambda () #f))) > (set-procedure-property! foo 'name name) foo)))))) > > (define-a a) > (format #t "Should say a: ~A~%" (procedure-property a 'name)) > (define-bar b) > (format #t "Should say bar: ~A~%" (procedure-property b 'name)) > (define-c c) > (format #t "Should say c: ~A~%" (procedure-property c 'name)) > (define-d d) > (format #t "Should say d: ~A~%" (procedure-property d 'name)) > > The output looks like this: > > Should say a: a > Should say bar: b > Should say c: foo > Should say d: foo > > I'm particularly interested in the C or D cases. > > Thanks! > > -- --Per Bothner per@bothner.com http://per.bothner.com/