public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: phiroc@free.fr
To: kawa@sourceware.org
Subject: define-syntax can only be used with local variables
Date: Fri, 10 Sep 2021 09:33:58 +0200 (CEST)	[thread overview]
Message-ID: <1301054857.197399065.1631259238004.JavaMail.root@zimbra65-e11.priv.proxad.net> (raw)
In-Reply-To: <971550055.197381511.1631259004148.JavaMail.root@zimbra65-e11.priv.proxad.net>

Hello,
in the below code, nil! and nil2! only set variables values to '() and '(0) when such variables are local (let).
When I run the code with LispKit Go Scheme, global variables (such as y below) are also set.
What gives?
Many thanks.
Philippe



;;
;; ..\bin\kawa -C .\javafx0.scm
;; java -cp "..\lib\kawa.jar;." javafx0

(let ((x '(1 2 3))) 
    (define-syntax nil!
        (syntax-rules ()
            ((_ x)
                (set! x '()))))
        (nil! x) (newline) (display x) (newline))

(define-syntax nil2!
    (syntax-rules ()
        ((_ x)
            (set! x '(0)))))

(let ((x2 '(4 5 6)))
    (nil2! x2)
    (display x2) (newline))

(define y '(1))
(nil2! y)
(display y) (newline)

(define (f-nil! x)
    (set! x '()))

(define z 4)
(f-nil! z)
(display z)

       reply	other threads:[~2021-09-10  7:34 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 [this message]
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
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=1301054857.197399065.1631259238004.JavaMail.root@zimbra65-e11.priv.proxad.net \
    --to=phiroc@free.fr \
    --cc=kawa@sourceware.org \
    /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).