* define-syntax can only be used with local variables
[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 17:26 ` Per Bothner
0 siblings, 2 replies; 21+ messages in thread
From: phiroc @ 2021-09-10 7:33 UTC (permalink / raw)
To: kawa
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)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-10 7:33 ` define-syntax can only be used with local variables phiroc
@ 2021-09-14 12:42 ` Damien Mattei
2021-09-14 16:14 ` Philippe de Rochambeau
2021-09-14 17:26 ` Per Bothner
1 sibling, 1 reply; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 12:42 UTC (permalink / raw)
To: phiroc; +Cc: kawa, Jean-Paul Roy
i have test one of your example and it works fine on my system:
mattei@moita ~]$ kawa
#|kawa:1|# (define-syntax nil2!
(syntax-rules ()
((_ x)
(set! x '(0)))))
#|(---:2|# #|(---:3|# #|(---:4|# #|kawa:5|#
#|kawa:6|# (define y '(1))
(nil2! y)
(display y) (newline)#|kawa:7|# #|kawa:8|#
(0)
#|kawa:9|# y
(0)
Damien
On Fri, Sep 10, 2021 at 9:34 AM phiroc--- via Kawa <kawa@sourceware.org>
wrote:
> 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)
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 12:42 ` Damien Mattei
@ 2021-09-14 16:14 ` Philippe de Rochambeau
2021-09-14 16:34 ` Damien Mattei
0 siblings, 1 reply; 21+ messages in thread
From: Philippe de Rochambeau @ 2021-09-14 16:14 UTC (permalink / raw)
To: Damien Mattei; +Cc: kawa, Jean-Paul Roy
I get (1) :
(define-syntax nil2!
(syntax-rules ()
((_ x)
(set! x '(0)))))
#|kawa:1|# (load "define2.scm")
#|kawa:2|# (define y '(1))
#|kawa:3|# y
(1)
#|kawa:4|# (nil2! y)
#|kawa:5|# y
(1)
#|kawa:6|#
I am using Kawa 3.1.1 on Macosx.
Philippe
> Le 14 sept. 2021 à 14:42, Damien Mattei <damien.mattei@gmail.com> a écrit :
>
> i have test one of your example and it works fine on my system:
> mattei@moita ~]$ kawa
> #|kawa:1|# (define-syntax nil2!
> (syntax-rules ()
> ((_ x)
> (set! x '(0)))))
> #|(---:2|# #|(---:3|# #|(---:4|# #|kawa:5|#
> #|kawa:6|# (define y '(1))
> (nil2! y)
> (display y) (newline)#|kawa:7|# #|kawa:8|#
> (0)
> #|kawa:9|# y
> (0)
>
> Damien
>
> On Fri, Sep 10, 2021 at 9:34 AM phiroc--- via Kawa <kawa@sourceware.org <mailto:kawa@sourceware.org>> wrote:
> 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)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 16:14 ` Philippe de Rochambeau
@ 2021-09-14 16:34 ` Damien Mattei
2021-09-14 16:58 ` Philippe de Rochambeau
0 siblings, 1 reply; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 16:34 UTC (permalink / raw)
To: Philippe de Rochambeau, Damien Mattei; +Cc: Jean-Paul Roy, kawa
i made my test on linux with a 2.0 or 2.1 version, testing on mac os x i
have the same error you have.
I installed it with brew:
mattei@macbook-pro-touch-bar ~ % brew install kawa
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
abricate cargo-outdated fastq-tools
locust reproc
age chrpath flamebearer
microsocks rollup
airspyhf cilium-cli fst
mimalloc sail
alembic cosign ghostunnel
mrbayes selene
ansilove cppzmq go@1.16
msgpack-cxx singularity
artillery cruft h2c
murex solana
atop cue htmlq nanoflann
spirv-llvm-translator
basis_universal datree jpdfbookmarks
newrelic-infra-agent spot
bat-extras dotbot kn
osc-cli uftrace
bbtools drill libaec
ots vespa-cli
bioperl eigenpy libmng
pari-galdata vite
bubblewrap esbuild librespot
pari-galpol vue-cli
cargo-bloat f2 librist
pari-seadata yt-dlp
cargo-llvm-lines fann lit pari-seadata-big
==> Updated Formulae
Updated 2158 formulae.
==> Renamed Formulae
kafkacat -> kcat
==> Deleted Formulae
boost@1.57 boost@1.60 procyon-decompiler
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/manifests/16.0.2
########################################################################
100.0%
==> Downloading
https://ghcr.io/v2/homebrew/core/openjdk/blobs/sha256:83b39e22b91173ee797b09e11bbcb08b3cff5c3aeed65f64cb5f8c4
==> Downloading from
https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:83b39e22b91173ee797b09e11bbcb08b3cff5c3a
########################################################################
100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/kawa/manifests/3.1.1_1
########################################################################
100.0%
==> Downloading
https://ghcr.io/v2/homebrew/core/kawa/blobs/sha256:4832b73db70b9b1c74289522820b9ba04c2eab1bf03285e4bfdfc76962
==> Downloading from
https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4832b73db70b9b1c74289522820b9ba04c2eab1b
########################################################################
100.0%
==> Installing dependencies for kawa: openjdk
==> Installing kawa dependency: openjdk
==> Pouring openjdk--16.0.2.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openjdk/16.0.2: 643 files, 281.5MB
==> Installing kawa
==> Pouring kawa--3.1.1_1.all.bottle.tar.gz
🍺 /opt/homebrew/Cellar/kawa/3.1.1_1: 12 files, 5MB
==> `brew cleanup` has not been run in the last 30 days, running now...
Removing: /Users/mattei/Library/Caches/Homebrew/m4--1.4.18... (228.4KB)
Removing: /Users/mattei/Library/Logs/Homebrew/pkg-config... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/libtool... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/gmp... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/libunistring... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/bdw-gc... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/readline... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/m4... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/guile... (64B)
Removing: /Users/mattei/Library/Logs/Homebrew/libffi... (64B)
mattei@macbook-pro-touch-bar ~ % kawa
#|kawa:1|# (define-syntax nil2!
#|.....2|# (syntax-rules ()
#|.....3|# ((_ x)
#|.....4|# (set! x '(0)))))
#|kawa:5|# (define y '(1))
#|kawa:6|# (nil2! y)
#|kawa:7|# y
(1)
with this problem i would made some test with an install from source if
you can and on other platform to see if it is a mac os x special
problem or a bug in the source code.
Damien
Le 14/09/2021 à 18:14, Philippe de Rochambeau via Kawa a écrit :
> I get (1) :
>
> (define-syntax nil2!
> (syntax-rules ()
> ((_ x)
> (set! x '(0)))))
>
>
> #|kawa:1|# (load "define2.scm")
> #|kawa:2|# (define y '(1))
> #|kawa:3|# y
> (1)
> #|kawa:4|# (nil2! y)
> #|kawa:5|# y
> (1)
> #|kawa:6|#
>
> I am using Kawa 3.1.1 on Macosx.
>
> Philippe
>
>
>> Le 14 sept. 2021 à 14:42, Damien Mattei <damien.mattei@gmail.com> a écrit :
>>
>> i have test one of your example and it works fine on my system:
>> mattei@moita ~]$ kawa
>> #|kawa:1|# (define-syntax nil2!
>> (syntax-rules ()
>> ((_ x)
>> (set! x '(0)))))
>> #|(---:2|# #|(---:3|# #|(---:4|# #|kawa:5|#
>> #|kawa:6|# (define y '(1))
>> (nil2! y)
>> (display y) (newline)#|kawa:7|# #|kawa:8|#
>> (0)
>> #|kawa:9|# y
>> (0)
>>
>> Damien
>>
>> On Fri, Sep 10, 2021 at 9:34 AM phiroc--- via Kawa <kawa@sourceware.org <mailto:kawa@sourceware.org>> wrote:
>> 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)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 16:34 ` Damien Mattei
@ 2021-09-14 16:58 ` Philippe de Rochambeau
0 siblings, 0 replies; 21+ messages in thread
From: Philippe de Rochambeau @ 2021-09-14 16:58 UTC (permalink / raw)
To: Damien.MATTEI; +Cc: Damien Mattei, Jean-Paul Roy, kawa
Hi Damien,
I’ll test it on Windows tomorrow on a different computer and let you know.
Cheers,
Philippe
PS are you a Kawa developer?
> Le 14 sept. 2021 à 18:34, Damien Mattei <damien.mattei@oca.eu> a écrit :
>
> i made my test on linux with a 2.0 or 2.1 version, testing on mac os x i have the same error you have.
>
> I installed it with brew:
>
> mattei@macbook-pro-touch-bar ~ % brew install kawa
> Updating Homebrew...
> ==> Auto-updated Homebrew!
> Updated 1 tap (homebrew/core).
> ==> New Formulae
> abricate cargo-outdated fastq-tools locust reproc
> age chrpath flamebearer microsocks rollup
> airspyhf cilium-cli fst mimalloc sail
> alembic cosign ghostunnel mrbayes selene
> ansilove cppzmq go@1.16 msgpack-cxx singularity
> artillery cruft h2c murex solana
> atop cue htmlq nanoflann spirv-llvm-translator
> basis_universal datree jpdfbookmarks newrelic-infra-agent spot
> bat-extras dotbot kn osc-cli uftrace
> bbtools drill libaec ots vespa-cli
> bioperl eigenpy libmng pari-galdata vite
> bubblewrap esbuild librespot pari-galpol vue-cli
> cargo-bloat f2 librist pari-seadata yt-dlp
> cargo-llvm-lines fann lit pari-seadata-big
> ==> Updated Formulae
> Updated 2158 formulae.
> ==> Renamed Formulae
> kafkacat -> kcat
> ==> Deleted Formulae
> boost@1.57 boost@1.60 procyon-decompiler
>
> ==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/manifests/16.0.2
> ######################################################################## 100.0%
> ==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/blobs/sha256:83b39e22b91173ee797b09e11bbcb08b3cff5c3aeed65f64cb5f8c4
> ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:83b39e22b91173ee797b09e11bbcb08b3cff5c3a
> ######################################################################## 100.0%
> ==> Downloading https://ghcr.io/v2/homebrew/core/kawa/manifests/3.1.1_1
> ######################################################################## 100.0%
> ==> Downloading https://ghcr.io/v2/homebrew/core/kawa/blobs/sha256:4832b73db70b9b1c74289522820b9ba04c2eab1bf03285e4bfdfc76962
> ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4832b73db70b9b1c74289522820b9ba04c2eab1b
> ######################################################################## 100.0%
> ==> Installing dependencies for kawa: openjdk
> ==> Installing kawa dependency: openjdk
> ==> Pouring openjdk--16.0.2.arm64_big_sur.bottle.tar.gz
> 🍺 /opt/homebrew/Cellar/openjdk/16.0.2: 643 files, 281.5MB
> ==> Installing kawa
> ==> Pouring kawa--3.1.1_1.all.bottle.tar.gz
> 🍺 /opt/homebrew/Cellar/kawa/3.1.1_1: 12 files, 5MB
> ==> `brew cleanup` has not been run in the last 30 days, running now...
> Removing: /Users/mattei/Library/Caches/Homebrew/m4--1.4.18... (228.4KB)
> Removing: /Users/mattei/Library/Logs/Homebrew/pkg-config... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/libtool... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/gmp... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/libunistring... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/bdw-gc... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/readline... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/m4... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/guile... (64B)
> Removing: /Users/mattei/Library/Logs/Homebrew/libffi... (64B)
> mattei@macbook-pro-touch-bar ~ % kawa
>
> #|kawa:1|# (define-syntax nil2!
> #|.....2|# (syntax-rules ()
> #|.....3|# ((_ x)
> #|.....4|# (set! x '(0)))))
> #|kawa:5|# (define y '(1))
> #|kawa:6|# (nil2! y)
> #|kawa:7|# y
> (1)
>
> with this problem i would made some test with an install from source if you can and on other platform to see if it is a mac os x special problem or a bug in the source code.
>
> Damien
>
>> Le 14/09/2021 à 18:14, Philippe de Rochambeau via Kawa a écrit :
>> I get (1) :
>>
>> (define-syntax nil2!
>> (syntax-rules ()
>> ((_ x)
>> (set! x '(0)))))
>>
>>
>> #|kawa:1|# (load "define2.scm")
>> #|kawa:2|# (define y '(1))
>> #|kawa:3|# y
>> (1)
>> #|kawa:4|# (nil2! y)
>> #|kawa:5|# y
>> (1)
>> #|kawa:6|#
>>
>> I am using Kawa 3.1.1 on Macosx.
>>
>> Philippe
>>
>>
>>>> Le 14 sept. 2021 à 14:42, Damien Mattei <damien.mattei@gmail.com> a écrit :
>>>
>>> i have test one of your example and it works fine on my system:
>>> mattei@moita ~]$ kawa
>>> #|kawa:1|# (define-syntax nil2!
>>> (syntax-rules ()
>>> ((_ x)
>>> (set! x '(0)))))
>>> #|(---:2|# #|(---:3|# #|(---:4|# #|kawa:5|#
>>> #|kawa:6|# (define y '(1))
>>> (nil2! y)
>>> (display y) (newline)#|kawa:7|# #|kawa:8|#
>>> (0)
>>> #|kawa:9|# y
>>> (0)
>>>
>>> Damien
>>>
>>>> On Fri, Sep 10, 2021 at 9:34 AM phiroc--- via Kawa <kawa@sourceware.org <mailto:kawa@sourceware.org>> wrote:
>>> 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)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-10 7:33 ` define-syntax can only be used with local variables phiroc
2021-09-14 12:42 ` Damien Mattei
@ 2021-09-14 17:26 ` Per Bothner
2021-09-14 17:38 ` Damien Mattei
2021-09-14 17:58 ` Damien Mattei
1 sibling, 2 replies; 21+ messages in thread
From: Per Bothner @ 2021-09-14 17:26 UTC (permalink / raw)
To: phiroc, kawa
On 9/10/21 12:33 AM, phiroc--- via Kawa wrote:
> Hello,
> in the below code, nil! and nil2! only set variables values to '() and '(0) when such variables are local (let).
I'm guessing (without having tested it) that the restriction isn't local variables
but lexical vs dynamic variables. I.e. it is likely that module-level (library-level)
variables would also work.
Probably a problem with macro hygiene. Though it's weird that it behaves differently on
different systems. Possibly different Java versionor different Kawa versions (though
I don't recall changing anything in this area in a while).
Could be a nice exercise to figure out for someone who
wants to understand how Kawa macro hygiene works.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 17:26 ` Per Bothner
@ 2021-09-14 17:38 ` Damien Mattei
2021-09-14 17:58 ` Damien Mattei
1 sibling, 0 replies; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 17:38 UTC (permalink / raw)
To: Per Bothner; +Cc: phiroc, kawa
downloading a binary version ok kawa from the official web site , i get the
same error, with the same openjdk 16:
mattei@macbook-pro-touch-bar bin % export
JAVA_HOME=/opt/homebrew/Cellar/openjdk/16.0.2
/opt/homebrew/Cellar/openjdk/16.0.2
mattei@macbook-pro-touch-bar bin % pwd
/Users/mattei/kawa-3.1.1/bin
mattei@macbook-pro-touch-bar bin % ./kawa
#|kawa:1|# (define-syntax nil2!
#|.....2|# (syntax-rules ()
#|.....3|# ((_ x)
#|.....4|# (set! x '(0)))))
#|.....5|# (define y '(1))
#|kawa:6|# (nil2! y)
#|kawa:7|# y
(1)
i will try the source version perhaps
damien
On Tue, Sep 14, 2021 at 7:27 PM Per Bothner <per@bothner.com> wrote:
>
>
> On 9/10/21 12:33 AM, phiroc--- via Kawa wrote:
> > Hello,
> > in the below code, nil! and nil2! only set variables values to '() and
> '(0) when such variables are local (let).
>
> I'm guessing (without having tested it) that the restriction isn't local
> variables
> but lexical vs dynamic variables. I.e. it is likely that module-level
> (library-level)
> variables would also work.
>
> Probably a problem with macro hygiene. Though it's weird that it behaves
> differently on
> different systems. Possibly different Java versionor different Kawa
> versions (though
> I don't recall changing anything in this area in a while).
>
> Could be a nice exercise to figure out for someone who
> wants to understand how Kawa macro hygiene works.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
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
1 sibling, 1 reply; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 17:58 UTC (permalink / raw)
To: Per Bothner; +Cc: phiroc, kawa
hello Per,
it is strange when downloading source and trying to compile it with same
openjdk 16 than the one use by binary i got two errors, the first one being:
javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are
incompatible;
it could be helpful to understand why before thinking to a problem of
hygiene because all is running well in kawa-2.1, i admit it is old and i do
nothing about what happen between those long times....
Damien
On Tue, Sep 14, 2021 at 7:27 PM Per Bothner <per@bothner.com> wrote:
>
>
> On 9/10/21 12:33 AM, phiroc--- via Kawa wrote:
> > Hello,
> > in the below code, nil! and nil2! only set variables values to '() and
> '(0) when such variables are local (let).
>
> I'm guessing (without having tested it) that the restriction isn't local
> variables
> but lexical vs dynamic variables. I.e. it is likely that module-level
> (library-level)
> variables would also work.
>
> Probably a problem with macro hygiene. Though it's weird that it behaves
> differently on
> different systems. Possibly different Java versionor different Kawa
> versions (though
> I don't recall changing anything in this area in a while).
>
> Could be a nice exercise to figure out for someone who
> wants to understand how Kawa macro hygiene works.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 17:58 ` Damien Mattei
@ 2021-09-14 18:00 ` Damien Mattei
2021-09-14 18:07 ` Per Bothner
0 siblings, 1 reply; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 18:00 UTC (permalink / raw)
To: Per Bothner; +Cc: phiroc, kawa, Jean-Paul Roy
i know nothing ,sorry for the typos
On Tue, Sep 14, 2021 at 7:58 PM Damien Mattei <damien.mattei@gmail.com>
wrote:
> hello Per,
> it is strange when downloading source and trying to compile it with same
> openjdk 16 than the one use by binary i got two errors, the first one being:
> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are
> incompatible;
> it could be helpful to understand why before thinking to a problem of
> hygiene because all is running well in kawa-2.1, i admit it is old and i do
> nothing about what happen between those long times....
> Damien
>
> On Tue, Sep 14, 2021 at 7:27 PM Per Bothner <per@bothner.com> wrote:
>
>>
>>
>> On 9/10/21 12:33 AM, phiroc--- via Kawa wrote:
>> > Hello,
>> > in the below code, nil! and nil2! only set variables values to '() and
>> '(0) when such variables are local (let).
>>
>> I'm guessing (without having tested it) that the restriction isn't local
>> variables
>> but lexical vs dynamic variables. I.e. it is likely that module-level
>> (library-level)
>> variables would also work.
>>
>> Probably a problem with macro hygiene. Though it's weird that it behaves
>> differently on
>> different systems. Possibly different Java versionor different Kawa
>> versions (though
>> I don't recall changing anything in this area in a while).
>>
>> Could be a nice exercise to figure out for someone who
>> wants to understand how Kawa macro hygiene works.
>> --
>> --Per Bothner
>> per@bothner.com http://per.bothner.com/
>>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 18:00 ` Damien Mattei
@ 2021-09-14 18:07 ` Per Bothner
2021-09-14 18:38 ` Damien Mattei
0 siblings, 1 reply; 21+ messages in thread
From: Per Bothner @ 2021-09-14 18:07 UTC (permalink / raw)
To: Damien Mattei; +Cc: phiroc, kawa, Jean-Paul Roy
On 9/14/21 11:00 AM, Damien Mattei wrote:
> i know nothing ,sorry for the typos
Does "I know nothing" means the problem went away or not?
> On Tue, Sep 14, 2021 at 7:58 PM Damien Mattei <damien.mattei@gmail.com <mailto:damien.mattei@gmail.com>> wrote:
> it is strange when downloading source and trying to compile it with same openjdk 16 than the one use by binary i got two errors, the first one being:
> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
I owuld expect a compiler to say why they're incompatible - like if some method conflicts.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 18:07 ` Per Bothner
@ 2021-09-14 18:38 ` Damien Mattei
2021-09-14 19:30 ` Per Bothner
0 siblings, 1 reply; 21+ messages in thread
From: Damien Mattei @ 2021-09-14 18:38 UTC (permalink / raw)
To: Per Bothner; +Cc: kawa
message of compiler is big, here is a part:
(for f in kawa/standard/SchemeScriptEngineFactory.java
kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java
kawa/ReplDocument.java kawa/ReplPaneOutPort.java
gnu/kawa/models/Box.java gnu/kawa/models/Button.java
gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java
gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java
gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java
gnu/kawa/models/Label.java gnu/kawa/models/Model.java
gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java
gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java
gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java
gnu/kawa/models/PBox.java gnu/kawa/models/Row.java
gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java
gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java
gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java
gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java
gnu/kawa/models/WithPaint.java gnu/kawa/models/WithTransform.java ; do
echo ./$f; done) >>tmp-list
mv tmp-list tmp-sources1.list
javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E>
are incompatible;
public interface CharSeq
^
interface CharSeq inherits abstract and default for isEmpty() from
types CharSequence and Sequence
where E is a type-variable:
E extends Object declared in interface Sequence
./gnu/lists/Convert.java:42: warning: [removal] Character(char) in
Character has been deprecated and marked for removal
return new Character(ch);
^
./gnu/lists/Convert.java:62: warning: [removal] Byte(byte) in Byte has
been deprecated and marked for removal
return new Byte(value);
^
./gnu/lists/Convert.java:82: warning: [removal] Integer(int) in Integer
has been deprecated and marked for removal
return new Integer(value & 0xFF);
^
./gnu/lists/Convert.java:102: warning: [removal] Short(short) in Short
has been deprecated and marked for removal
return new Short(value);
^
./gnu/lists/Convert.java:122: warning: [removal] Integer(int) in Integer
has been deprecated and marked for removal
return new Integer(value & 0xFFFF);
^
./gnu/lists/Convert.java:142: warning: [removal] Integer(int) in Integer
has been deprecated and marked for removal
return new Integer(value);
^
./gnu/lists/Convert.java:163: warning: [removal] Integer(int) in Integer
has been deprecated and marked for removal
return new Integer(value);
^
./gnu/lists/Convert.java:165: warning: [removal] Long(long) in Long has
been deprecated and marked for removal
return new Long((long) value & 0xffffffffL);
^
./gnu/lists/Convert.java:185: warning: [removal] Long(long) in Long has
been deprecated and marked for removal
return new Long(value);
^
./gnu/lists/Convert.java:205: warning: [removal] Long(long) in Long has
been deprecated and marked for removal
return new Long(value); // FIXME use BigInteger?
^
./gnu/lists/Convert.java:225: warning: [removal] Float(float) in Float
has been deprecated and marked for removal
return new Float(value);
^
./gnu/lists/Convert.java:245: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
return new Double(value);
^
./gnu/text/Options.java:92: warning: [removal] Integer(String) in
Integer has been deprecated and marked for removal
return new Integer(argument);
^
./gnu/expr/LetExp.java:162: warning: [removal] Byte(byte) in Byte has
been deprecated and marked for removal
init = new QuoteExp(new Byte((byte) 0));
^
./gnu/expr/LitTable.java:155: warning: [removal] Boolean(boolean) in
Boolean has been deprecated and marked for removal
push(new Boolean(v), Type.booleanType);
^
./gnu/expr/LitTable.java:160: warning: [removal] Character(char) in
Character has been deprecated and marked for removal
push(new Character((char) v), Type.charType);
^
./gnu/expr/LitTable.java:165: warning: [removal] Byte(byte) in Byte has
been deprecated and marked for removal
push(new Byte((byte) v), Type.byteType);
^
./gnu/expr/LitTable.java:170: warning: [removal] Short(short) in Short
has been deprecated and marked for removal
push(new Short((short) v), Type.shortType);
^
./gnu/expr/LitTable.java:175: warning: [removal] Integer(int) in Integer
has been deprecated and marked for removal
push(new Integer(v), Type.intType);
^
./gnu/expr/LitTable.java:180: warning: [removal] Long(long) in Long has
been deprecated and marked for removal
push(new Long(v), Type.longType);
^
./gnu/expr/LitTable.java:185: warning: [removal] Float(float) in Float
has been deprecated and marked for removal
push(new Float(v), Type.floatType);
^
./gnu/expr/LitTable.java:190: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
push(new Double(v), Type.doubleType);
^
./gnu/kawa/util/RangeTable.java:17: warning: [removal] Integer(int) in
Integer has been deprecated and marked for removal
return hash.get(new Integer(key));
^
./gnu/kawa/util/RangeTable.java:29: warning: [removal] Integer(int) in
Integer has been deprecated and marked for removal
hash.put(new Integer(i), value);
^
./gnu/kawa/util/RangeTable.java:49: warning: [removal] Integer(int) in
Integer has been deprecated and marked for removal
hash.remove(new Integer(i));
^
./gnu/kawa/reflect/CompileInvoke.java:64: warning: [removal]
Integer(int) in Integer has been deprecated and marked for removal
sizeArg = QuoteExp.getInstance(new Integer(args.length-1));
^
./gnu/kawa/reflect/CompileInvoke.java:125: warning: [removal]
Integer(int) in Integer has been deprecated and marked for removal
QuoteExp.getInstance(new Integer(index)),
^
./gnu/kawa/functions/AddOp.java:75: warning: [removal] Float(float) in
Float has been deprecated and marked for removal
return new Float(plusOrMinus > 0 ? f1 + f2 : f1 - f2);
^
./gnu/kawa/functions/AddOp.java:79: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
return new Double(plusOrMinus > 0 ? d1 + d2 : d1 - d2);
^
./gnu/kawa/functions/AddOp.java:123: warning: [removal] Float(float) in
Float has been deprecated and marked for removal
return new Float(- Arithmetic.asFloat(arg1));
^
./gnu/kawa/functions/AddOp.java:125: warning: [removal] Double(double)
in Double has been deprecated and marked for removal
return new Double(- Arithmetic.asDouble(arg1));
^
./gnu/kawa/functions/MultiplyOp.java:90: warning: [removal] Float(float)
in Float has been deprecated and marked for removal
result = new Float(f1 * f2);
^
./gnu/kawa/functions/MultiplyOp.java:95: warning: [removal]
Double(double) in Double has been deprecated and marked for removal
result = new Double(d1 * d2);
^
./gnu/kawa/lispexpr/LangPrimType.java:170: warning: [removal]
Character(char) in Character has been deprecated and marked for removal
return new Character(((Char) obj).charValue());
^
./gnu/ecmascript/BinaryOp.java:20: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
return new Double(apply(Convert.toNumber(arg1),
Convert.toNumber(arg2)));
^
./gnu/ecmascript/Lexer.java:109: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
return new Double(dval);
^
./gnu/ecmascript/Lexer.java:165: warning: [removal] Double(String) in
Double has been deprecated and marked for removal
return new Double(str.toString ());
^
./gnu/xquery/lang/XQParser.java:2989: warning: [removal] Double(String)
in Double has been deprecated and marked for removal
val = new java.lang.Double(str);
^
./gnu/xquery/util/ArithOp.java:124: warning: [removal] Float(float) in
Float has been deprecated and marked for removal
return new Float(((Number) arg1).floatValue()
^
./gnu/xquery/util/ArithOp.java:129: warning: [removal] Double(double) in
Double has been deprecated and marked for removal
return new Double(((Number) arg1).doubleValue()
^
./gnu/xquery/util/NumberValue.java:16: warning: [removal] Double(double)
in Double has been deprecated and marked for removal
public static final Double NaN = new Double(Double.NaN);
^
./kawa/standard/make.java:38: error: reference to Record is ambiguous
Record.set1(arg, key.getName(), result);
^
both class kawa.lang.Record in kawa.lang and class java.lang.Record
in java.lang match
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
41 warnings
make[3]: *** [javac-all] Error 1
make[2]: *** [misc-classes.stamp] Error 2
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
there was also warnings before this message...
Damien
Le 14/09/2021 à 20:07, Per Bothner a écrit :
> On 9/14/21 11:00 AM, Damien Mattei wrote:
>> i know nothing ,sorry for the typos
>
> Does "I know nothing" means the problem went away or not?
>
>> On Tue, Sep 14, 2021 at 7:58 PM Damien Mattei
>> <damien.mattei@gmail.com <mailto:damien.mattei@gmail.com>> wrote:
>> it is strange when downloading source and trying to compile it
>> with same openjdk 16 than the one use by binary i got two errors, the
>> first one being:
>> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
>> ./gnu/lists/CharSeq.java:11: error: types CharSequence and
>> Sequence<E> are incompatible;
>
> I owuld expect a compiler to say why they're incompatible - like if
> some method conflicts.
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 18:38 ` Damien Mattei
@ 2021-09-14 19:30 ` Per Bothner
2021-09-15 7:10 ` phiroc
0 siblings, 1 reply; 21+ messages in thread
From: Per Bothner @ 2021-09-14 19:30 UTC (permalink / raw)
To: Damien.MATTEI; +Cc: kawa
On 9/14/21 11:38 AM, Damien Mattei wrote:
> message of compiler is big, here is a part:
>
> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
> mv tmp-list tmp-sources1.list
> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
> public interface CharSeq
> ^
> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
> where E is a type-variable:
> E extends Object declared in interface Sequence
I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
I'm not seeing this error. I'm seeing the warnings, most of which seem to
be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
I'm working on those now.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-14 19:30 ` Per Bothner
@ 2021-09-15 7:10 ` phiroc
2021-09-16 10:02 ` phiroc
0 siblings, 1 reply; 21+ messages in thread
From: phiroc @ 2021-09-15 7:10 UTC (permalink / raw)
To: kawa
Good morning,
on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
Best regards,
Philippe
-----------------------------------------------
(define-syntax nil2!
(syntax-rules ()
((_ x)
(set! x '(0)))))
(define y '(1))
(nil2! y)
(display y) (newline)
----- Mail original -----
De: "Per Bothner" <per@bothner.com>
À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
Cc: kawa@sourceware.org
Envoyé: Mardi 14 Septembre 2021 21:30:55
Objet: Re: define-syntax can only be used with local variables
On 9/14/21 11:38 AM, Damien Mattei wrote:
> message of compiler is big, here is a part:
>
> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
> mv tmp-list tmp-sources1.list
> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
> public interface CharSeq
> ^
> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
> where E is a type-variable:
> E extends Object declared in interface Sequence
I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
I'm not seeing this error. I'm seeing the warnings, most of which seem to
be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
I'm working on those now.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-15 7:10 ` phiroc
@ 2021-09-16 10:02 ` phiroc
2021-09-16 10:41 ` Damien MATTEI
2021-09-16 21:11 ` Per Bothner
0 siblings, 2 replies; 21+ messages in thread
From: phiroc @ 2021-09-16 10:02 UTC (permalink / raw)
To: phiroc; +Cc: kawa
Hello,
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
----- Mail original -----
De: "phiroc--- via Kawa" <kawa@sourceware.org>
À: kawa@sourceware.org
Envoyé: Mercredi 15 Septembre 2021 09:10:15
Objet: Re: define-syntax can only be used with local variables
Good morning,
on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
Best regards,
Philippe
-----------------------------------------------
(define-syntax nil2!
(syntax-rules ()
((_ x)
(set! x '(0)))))
(define y '(1))
(nil2! y)
(display y) (newline)
----- Mail original -----
De: "Per Bothner" <per@bothner.com>
À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
Cc: kawa@sourceware.org
Envoyé: Mardi 14 Septembre 2021 21:30:55
Objet: Re: define-syntax can only be used with local variables
On 9/14/21 11:38 AM, Damien Mattei wrote:
> message of compiler is big, here is a part:
>
> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
> mv tmp-list tmp-sources1.list
> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
> public interface CharSeq
> ^
> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
> where E is a type-variable:
> E extends Object declared in interface Sequence
I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
I'm not seeing this error. I'm seeing the warnings, most of which seem to
be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
I'm working on those now.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-16 10:02 ` phiroc
@ 2021-09-16 10:41 ` Damien MATTEI
2021-09-16 11:05 ` phiroc
2021-09-16 21:11 ` Per Bothner
1 sibling, 1 reply; 21+ messages in thread
From: Damien MATTEI @ 2021-09-16 10:41 UTC (permalink / raw)
To: kawa
but why is it working with one version of kawa and not another? or did i
missed something in discussion?
Damien
Le 16/09/2021 à 12:02, phiroc--- via Kawa a écrit :
> Hello,
> 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
>
>
>
> ----- Mail original -----
> De: "phiroc--- via Kawa" <kawa@sourceware.org>
> À: kawa@sourceware.org
> Envoyé: Mercredi 15 Septembre 2021 09:10:15
> Objet: Re: define-syntax can only be used with local variables
>
> Good morning,
> on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
> Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
> Best regards,
> Philippe
>
> -----------------------------------------------
>
>
>
>
> (define-syntax nil2!
> (syntax-rules ()
> ((_ x)
> (set! x '(0)))))
>
> (define y '(1))
> (nil2! y)
> (display y) (newline)
>
>
>
>
> ----- Mail original -----
> De: "Per Bothner" <per@bothner.com>
> À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
> Cc: kawa@sourceware.org
> Envoyé: Mardi 14 Septembre 2021 21:30:55
> Objet: Re: define-syntax can only be used with local variables
>
>
>
> On 9/14/21 11:38 AM, Damien Mattei wrote:
>> message of compiler is big, here is a part:
>>
>> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
>> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
>> mv tmp-list tmp-sources1.list
>> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
>> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
>> public interface CharSeq
>> ^
>> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
>> where E is a type-variable:
>> E extends Object declared in interface Sequence
> I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
> I'm not seeing this error. I'm seeing the warnings, most of which seem to
> be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
> I'm working on those now.
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
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
0 siblings, 2 replies; 21+ messages in thread
From: phiroc @ 2021-09-16 11:05 UTC (permalink / raw)
To: Damien MATTEI; +Cc: kawa
Hi,
I've no idea. The Kawa Developers, if they are are reading this thread, may be able to answer your question.
Perhaps, there was no distinction between the Transformer (Macro) Environment and the Normal Environment in Kawa 2.0, contrary to Kawa 3.1.1.
All in all, the Chinese Wall between the Transformer Environment and the Normal Environment is good because it prevents you from shooting yourself in the foot.
----- Mail original -----
De: "Damien MATTEI" <damien.mattei@oca.eu>
À: kawa@sourceware.org
Envoyé: Jeudi 16 Septembre 2021 12:41:31
Objet: Re: define-syntax can only be used with local variables
but why is it working with one version of kawa and not another? or did i
missed something in discussion?
Damien
Le 16/09/2021 à 12:02, phiroc--- via Kawa a écrit :
> Hello,
> 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
>
>
>
> ----- Mail original -----
> De: "phiroc--- via Kawa" <kawa@sourceware.org>
> À: kawa@sourceware.org
> Envoyé: Mercredi 15 Septembre 2021 09:10:15
> Objet: Re: define-syntax can only be used with local variables
>
> Good morning,
> on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
> Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
> Best regards,
> Philippe
>
> -----------------------------------------------
>
>
>
>
> (define-syntax nil2!
> (syntax-rules ()
> ((_ x)
> (set! x '(0)))))
>
> (define y '(1))
> (nil2! y)
> (display y) (newline)
>
>
>
>
> ----- Mail original -----
> De: "Per Bothner" <per@bothner.com>
> À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
> Cc: kawa@sourceware.org
> Envoyé: Mardi 14 Septembre 2021 21:30:55
> Objet: Re: define-syntax can only be used with local variables
>
>
>
> On 9/14/21 11:38 AM, Damien Mattei wrote:
>> message of compiler is big, here is a part:
>>
>> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
>> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
>> mv tmp-list tmp-sources1.list
>> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
>> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
>> public interface CharSeq
>> ^
>> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
>> where E is a type-variable:
>> E extends Object declared in interface Sequence
> I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
> I'm not seeing this error. I'm seeing the warnings, most of which seem to
> be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
> I'm working on those now.
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-16 11:05 ` phiroc
@ 2021-09-16 13:44 ` Damien MATTEI
2021-09-17 5:29 ` Per Bothner
1 sibling, 0 replies; 21+ messages in thread
From: Damien MATTEI @ 2021-09-16 13:44 UTC (permalink / raw)
To: phiroc, Damien MATTEI; +Cc: kawa, Jean-Paul Roy
you know in Scheme ,things are sometimes weird, look at this example
where i just encountered an 'undefined x' at line 4 of foo:
#lang racket
(define (foo)
(let ((x 7))
(let ((x 3))
(display x) ;; undefined x here !
(newline)
(define x 2)
(display x)
(newline))
(display x)
(newline)))
it was just that the define 2 lines after! create the problem
i admit it is an example build to create problems! LOL
Damien
Le 16/09/2021 à 13:05, phiroc@free.fr a écrit :
> Hi,
> I've no idea. The Kawa Developers, if they are are reading this thread, may be able to answer your question.
> Perhaps, there was no distinction between the Transformer (Macro) Environment and the Normal Environment in Kawa 2.0, contrary to Kawa 3.1.1.
> All in all, the Chinese Wall between the Transformer Environment and the Normal Environment is good because it prevents you from shooting yourself in the foot.
>
>
> ----- Mail original -----
> De: "Damien MATTEI" <damien.mattei@oca.eu>
> À: kawa@sourceware.org
> Envoyé: Jeudi 16 Septembre 2021 12:41:31
> Objet: Re: define-syntax can only be used with local variables
>
> but why is it working with one version of kawa and not another? or did i
> missed something in discussion?
>
> Damien
>
> Le 16/09/2021 à 12:02, phiroc--- via Kawa a écrit :
>
>> Hello,
>> 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
>>
>>
>>
>> ----- Mail original -----
>> De: "phiroc--- via Kawa" <kawa@sourceware.org>
>> À: kawa@sourceware.org
>> Envoyé: Mercredi 15 Septembre 2021 09:10:15
>> Objet: Re: define-syntax can only be used with local variables
>>
>> Good morning,
>> on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
>> Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
>> Best regards,
>> Philippe
>>
>> -----------------------------------------------
>>
>>
>>
>>
>> (define-syntax nil2!
>> (syntax-rules ()
>> ((_ x)
>> (set! x '(0)))))
>>
>> (define y '(1))
>> (nil2! y)
>> (display y) (newline)
>>
>>
>>
>>
>> ----- Mail original -----
>> De: "Per Bothner" <per@bothner.com>
>> À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
>> Cc: kawa@sourceware.org
>> Envoyé: Mardi 14 Septembre 2021 21:30:55
>> Objet: Re: define-syntax can only be used with local variables
>>
>>
>>
>> On 9/14/21 11:38 AM, Damien Mattei wrote:
>>> message of compiler is big, here is a part:
>>>
>>> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
>>> gnu/kawa/models/WithTransform.java ; do echo ./$f; done) >>tmp-list
>>> mv tmp-list tmp-sources1.list
>>> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
>>> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
>>> public interface CharSeq
>>> ^
>>> interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
>>> where E is a type-variable:
>>> E extends Object declared in interface Sequence
>> I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
>> I'm not seeing this error. I'm seeing the warnings, most of which seem to
>> be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
>> I'm working on those now.
>>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-16 10:02 ` phiroc
2021-09-16 10:41 ` Damien MATTEI
@ 2021-09-16 21:11 ` Per Bothner
1 sibling, 0 replies; 21+ messages in thread
From: Per Bothner @ 2021-09-16 21:11 UTC (permalink / raw)
To: phiroc; +Cc: kawa
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/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
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
1 sibling, 1 reply; 21+ messages in thread
From: Per Bothner @ 2021-09-17 5:29 UTC (permalink / raw)
To: phiroc; +Cc: kawa
On 9/16/21 4:05 AM, phiroc--- via Kawa wrote:
> Hi,
> I've no idea. The Kawa Developers, if they are are reading this thread, may be able to answer your question.
The "Kawa developers" is mostly me, and I'm focused on other projects.
The problem is because a new declaration for y is created. And that turned out
to be a kludge done to fix this: https://gitlab.com/kashell/Kawa/-/issues/44
See the code in kawa/standard/set_b.java following
// A kludge to treat interactive set! as similar to (re-)definition.
It probably makes sense to remove this kludge - but then trace/untrace
breaks for functions defined in a REPL. A better fix for issue 44 may
be possible.
Kawa is very focused on efficiency, compilation, and static analysis.
A REPL where anything can be redefined is the opposite. Supporting
both is difficult.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-17 5:29 ` Per Bothner
@ 2021-09-17 7:00 ` phiroc
2021-09-17 10:48 ` Per Bothner
0 siblings, 1 reply; 21+ messages in thread
From: phiroc @ 2021-09-17 7:00 UTC (permalink / raw)
To: Per Bothner; +Cc: kawa
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.
Case closed.
Best regards,
Philippe
----- Mail original -----
De: "Per Bothner" <per@bothner.com>
À: phiroc@free.fr
Cc: kawa@sourceware.org
Envoyé: Vendredi 17 Septembre 2021 07:29:42
Objet: Re: define-syntax can only be used with local variables
On 9/16/21 4:05 AM, phiroc--- via Kawa wrote:
> Hi,
> I've no idea. The Kawa Developers, if they are are reading this thread, may be able to answer your question.
The "Kawa developers" is mostly me, and I'm focused on other projects.
The problem is because a new declaration for y is created. And that turned out
to be a kludge done to fix this: https://gitlab.com/kashell/Kawa/-/issues/44
See the code in kawa/standard/set_b.java following
// A kludge to treat interactive set! as similar to (re-)definition.
It probably makes sense to remove this kludge - but then trace/untrace
breaks for functions defined in a REPL. A better fix for issue 44 may
be possible.
Kawa is very focused on efficiency, compilation, and static analysis.
A REPL where anything can be redefined is the opposite. Supporting
both is difficult.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: define-syntax can only be used with local variables
2021-09-17 7:00 ` phiroc
@ 2021-09-17 10:48 ` Per Bothner
0 siblings, 0 replies; 21+ messages in thread
From: Per Bothner @ 2021-09-17 10:48 UTC (permalink / raw)
To: phiroc; +Cc: kawa
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/
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2021-09-17 10:48 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <971550055.197381511.1631259004148.JavaMail.root@zimbra65-e11.priv.proxad.net>
2021-09-10 7:33 ` define-syntax can only be used with local variables 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
2021-09-16 21:11 ` Per Bothner
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).