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 0AD6A3858D29 for ; Fri, 17 Sep 2021 10:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0AD6A3858D29 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.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1mRBPr-0000Vn-HT; Fri, 17 Sep 2021 12:48:23 +0200 Received: by submission03.runbox with esmtpsa [Authenticated ID (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1mRBPm-0002Qq-NH; Fri, 17 Sep 2021 12:48:18 +0200 Subject: Re: define-syntax can only be used with local variables To: phiroc@free.fr Cc: kawa@sourceware.org References: <1713055755.220998399.1631862007856.JavaMail.root@zimbra65-e11.priv.proxad.net> From: Per Bothner Message-ID: <454a1ecf-adcb-43a9-ce47-29ec45d8b667@bothner.com> Date: Fri, 17 Sep 2021 03:48:14 -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: <1713055755.220998399.1631862007856.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: Fri, 17 Sep 2021 10:48:28 -0000 On 9/17/21 12:00 AM, phiroc@free.fr wrote: > Hi Per, > > thank you for you input. > > The R7RS report says the following: > > "If the define-syntax occurs at the outermost level, then > the global syntactic environment is extended by binding > the keyword to the specified transformer, but previous > expansions of any global binding for keyword remain unchanged. > Otherwise, it is an internal syntax definition, and > is local to the body in which it is defined. Any use of a > syntax keyword before its corresponding definition is an > error. In particular, any use that precedes an inner definition > will not apply an outer definition." > > So, as far as I am concerned, Kawa's behavior is the norm: > a previously-defined global variable can't be reset by a define-syntax. That is not what R7RS is saying. It is talking about when you define a keyword FOO using define-syntax at the outermost level; then use (expand) FOO; then redefine FOO: In that case the previous expansions of FOO are unchanged. This is in contrast to a function re-definition, where calls to FOO in old calls should use the new FOO. Kawa by default does some inlining that conflicts with this goal, hence the kludge solution for issue #44. Kawa has a --no-inline flag that makes Kawa behave more like a traditional Scheme REPL. Doing --no-inline has some problems, but perhaps a modified --no-inline default for REPLs might work. -- --Per Bothner per@bothner.com http://per.bothner.com/