From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aibo.runbox.com (aibo.runbox.com [91.220.196.211]) by sourceware.org (Postfix) with ESMTPS id B7B633858D3C for ; Thu, 16 Sep 2021 21:11:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7B633858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bothner.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bothner.com Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1mQyfB-0001GV-0D; Thu, 16 Sep 2021 23:11:21 +0200 Received: by submission01.runbox with esmtpsa [Authenticated ID (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1mQyfA-0004Li-0p; Thu, 16 Sep 2021 23:11:20 +0200 Subject: Re: define-syntax can only be used with local variables To: phiroc@free.fr Cc: kawa@sourceware.org References: <2141982858.217799834.1631786557791.JavaMail.root@zimbra65-e11.priv.proxad.net> From: Per Bothner Message-ID: Date: Thu, 16 Sep 2021 14:11:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <2141982858.217799834.1631786557791.JavaMail.root@zimbra65-e11.priv.proxad.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 21:11:25 -0000 On 9/16/21 3:02 AM, phiroc--- via Kawa wrote: > here's an explanation : > > "The statement (set! *myglobal* "This does not") is executed in the transformer environment, not the normal environment. So it's not able to find *myglobal. We need to get both the expressions executed in the environment where *myglobal* is defined." > > cf. https://stackoverflow.com/questions/5509837/set-global-from-scheme-macro This quote isn't relevant, as far as I can tell. First, it is Racket, which is not-quite-Scheme. For one thing, Kawa doesn't have as strict as phase separation as Racket - or some other Schemes. Furthermore, the example uses define-macro, which is for legacy (non-hygienic) macros. Finally, in your original question the assigned variable is a macro parameter, which is very different from being in the scope of the macro definition. -- --Per Bothner per@bothner.com http://per.bothner.com/