public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: phiroc@free.fr
Cc: kawa@sourceware.org
Subject: Re: define-syntax can only be used with local variables
Date: Fri, 17 Sep 2021 03:48:14 -0700	[thread overview]
Message-ID: <454a1ecf-adcb-43a9-ce47-29ec45d8b667@bothner.com> (raw)
In-Reply-To: <1713055755.220998399.1631862007856.JavaMail.root@zimbra65-e11.priv.proxad.net>



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/

  reply	other threads:[~2021-09-17 10:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <971550055.197381511.1631259004148.JavaMail.root@zimbra65-e11.priv.proxad.net>
2021-09-10  7:33 ` phiroc
2021-09-14 12:42   ` Damien Mattei
2021-09-14 16:14     ` Philippe de Rochambeau
2021-09-14 16:34       ` Damien Mattei
2021-09-14 16:58         ` Philippe de Rochambeau
2021-09-14 17:26   ` Per Bothner
2021-09-14 17:38     ` Damien Mattei
2021-09-14 17:58     ` Damien Mattei
2021-09-14 18:00       ` Damien Mattei
2021-09-14 18:07         ` Per Bothner
2021-09-14 18:38           ` Damien Mattei
2021-09-14 19:30             ` Per Bothner
2021-09-15  7:10               ` phiroc
2021-09-16 10:02                 ` phiroc
2021-09-16 10:41                   ` Damien MATTEI
2021-09-16 11:05                     ` phiroc
2021-09-16 13:44                       ` Damien MATTEI
2021-09-17  5:29                       ` Per Bothner
2021-09-17  7:00                         ` phiroc
2021-09-17 10:48                           ` Per Bothner [this message]
2021-09-16 21:11                   ` 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=454a1ecf-adcb-43a9-ce47-29ec45d8b667@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    --cc=phiroc@free.fr \
    /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).