* Reader handling of the @ character
@ 2020-06-29 1:44 Duncan Mak
2020-06-29 3:04 ` Per Bothner
0 siblings, 1 reply; 5+ messages in thread
From: Duncan Mak @ 2020-06-29 1:44 UTC (permalink / raw)
To: kawa mailing list
Hello all,
I'm playing with the Alex Shinn match.scm macro again and I noticed that it
doesn't load in Kawa,
I think it's failing because of the handling of the @ character, probably
due to how the splice operator was implemented.
I tried the following in Chez, this is what I see with this test
syntax-rules macro:
$ chez
Chez Scheme Version 9.5.2
Copyright 1984-2019 Cisco Systems, Inc.
> (define-syntax test
(syntax-rules (@)
((test @ x y z) (list x y z))))
> (test @ 1 2 3)
(1 2 3)
> (test 1 2 3)
Exception: invalid syntax (test 1 2 3)
Type (debug) to enter the debugger.
>
The same macro doesn't work in Kawa 3.1.1:
$ kawa
#|kawa:1|# (define-syntax test
#|.....2|# (syntax-rules (@)
#|.....3|# ((test @ x y z) (list x y z))))
#|.....4|#
/dev/tty:2:20: invalid character #\)
#|kawa:5|# (test @ 1 2 3)
/dev/tty:5:2: warning - no declaration seen for test
/dev/tty:5:2: unbound location: test
at gnu.mapping.DynamicLocation.get(DynamicLocation.java:36)
at atInteractiveLevel-2.run(tty:5)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:290)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211)
at kawa.Shell.run(Shell.java:289)
at kawa.Shell.run(Shell.java:196)
at kawa.Shell.run(Shell.java:183)
at kawa.repl.processArgs(repl.java:724)
at kawa.repl.main(repl.java:830)
--
Duncan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reader handling of the @ character
2020-06-29 1:44 Reader handling of the @ character Duncan Mak
@ 2020-06-29 3:04 ` Per Bothner
2020-06-29 14:05 ` Per Bothner
0 siblings, 1 reply; 5+ messages in thread
From: Per Bothner @ 2020-06-29 3:04 UTC (permalink / raw)
To: Duncan Mak, kawa mailing list
On 6/28/20 6:44 PM, Duncan Mak via Kawa wrote:
> Hello all,
>
> I'm playing with the Alex Shinn match.scm macro again and I noticed that it
> doesn't load in Kawa,
>
> I think it's failing because of the handling of the @ character probably
> due to how the splice operator was implemented.
This seems to work:
(define-syntax test
(syntax-rules (|@|)
((test @ x y z) (list x y z))))
The --r7rs flag also works.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reader handling of the @ character
2020-06-29 3:04 ` Per Bothner
@ 2020-06-29 14:05 ` Per Bothner
2020-06-29 22:52 ` Damien MATTEI
0 siblings, 1 reply; 5+ messages in thread
From: Per Bothner @ 2020-06-29 14:05 UTC (permalink / raw)
To: kawa
On 6/28/20 8:04 PM, Per Bothner wrote:
> This seems to work:
>
> (define-syntax test
> (syntax-rules (|@|)
> ((test @ x y z) (list x y z))))
>
> The --r7rs flag also works.
>
In private email I was asked about |@| and --r7rs.
The slice operator
@expression
is converted by the Kawa reader into:
($splice$ expression)
The vertical bars in |@| makes @ into a regular
symbol and disables the special treatment of the @ character.
The --r7rs command-line flag disables Kawa extensions that
conflict with strict R7RS compatibility:
https://www.gnu.org/software/kawa/Options.html#Options-for-language-selection
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reader handling of the @ character
2020-06-29 14:05 ` Per Bothner
@ 2020-06-29 22:52 ` Damien MATTEI
2020-06-29 22:56 ` Per Bothner
0 siblings, 1 reply; 5+ messages in thread
From: Damien MATTEI @ 2020-06-29 22:52 UTC (permalink / raw)
To: kawa
thanks,
my mail was intend to be in the mailing list.
Le 29/06/2020 à 16:05, Per Bothner a écrit :
> On 6/28/20 8:04 PM, Per Bothner wrote:
>> This seems to work:
>>
>> (define-syntax test
>> (syntax-rules (|@|)
>> ((test @ x y z) (list x y z))))
>>
>> The --r7rs flag also works.
>>
>
> In private email I was asked about |@| and --r7rs.
>
> The slice operator
> @expression
> is converted by the Kawa reader into:
> ($splice$ expression)
>
> The vertical bars in |@| makes @ into a regular
> symbol and disables the special treatment of the @ character.
>
> The --r7rs command-line flag disables Kawa extensions that
> conflict with strict R7RS compatibility:
>
> https://www.gnu.org/software/kawa/Options.html#Options-for-language-selection
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reader handling of the @ character
2020-06-29 22:52 ` Damien MATTEI
@ 2020-06-29 22:56 ` Per Bothner
0 siblings, 0 replies; 5+ messages in thread
From: Per Bothner @ 2020-06-29 22:56 UTC (permalink / raw)
To: Damien MATTEI, kawa
On 6/29/20 3:52 PM, Damien MATTEI wrote:
> thanks,
>
> my mail was intend to be in the mailing list.
I guessed that, which is why I replied publicly,
but without identification ...
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-29 22:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 1:44 Reader handling of the @ character Duncan Mak
2020-06-29 3:04 ` Per Bothner
2020-06-29 14:05 ` Per Bothner
2020-06-29 22:52 ` Damien MATTEI
2020-06-29 22:56 ` 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).