SRFI 46 ellipsis renaming not supported
From SRFI 46:
;;; This example demonstrates the hygienic renaming of the ellipsis
;;; identifiers.
(let-syntax
((f (syntax-rules ()
((f ?e)
(let-syntax
((g (syntax-rules ::: ()
((g (??x ?e) (??y :::))
'((??x) ?e (??y) :::)))))
(g (1 2) (3 4)))))))
(f :::))
; => ((1) 2 (3) (4)), if hygienic rules of ellipsis identifiers are
; correctly implemented, not ((1) (2) (3) (4))
Comments (6)
-
repo owner -
repo owner - changed status to resolved
Importing (scheme base) on R7RS mode REPL. (Fixes
#198)→ <<cset c3011b0fdb63>>
-
reporter Thanks! However I applied the patch in c3011b0fdb63 to 0.7.8 and still get an error:
$ sash -r7 sash[r7rs]> (let-syntax ((f (syntax-rules () ((f ?e) (let-syntax ((g (syntax-rules ooo () ((g (??x ?e) (??y ooo)) '((??x) ?e (??y) ooo))))) (g (1 2) (3 4))))))) (f ooo)) Unhandled exception Condition components: 1. &compile program: (let-syntax ((f (syntax-rules () ((f ?e) (let-syntax ((g (sy source: #f 2. &compile program: (syntax-rules ooo () ((g (??x ooo) (??y ooo)) '((??x) ooo (? source: #f 3. &syntax subform: #f form: (syntax-rules ooo () ((g (??x ooo) (??y ooo)) '((??x) ooo (??y) ooo))) 4. &who #<identifier syntax-rules#user (#:id.2 #f #f . #f) (0x107b077c0):1> 5. &message invalid syntax stack trace: [1] report-error [2] #f src: ((current-exception-printer) c (current-error-port "/usr/local/share/sagittarius/0.7.8/lib/sagittarius/interactive.scm":133 [3] default-exception-handler [4] raise [5] default-exception-handler [6] raise [7] default-exception-handler [8] raise [9] dynamic-wind [10] pass1 [11] pass1 [12] with-error-handler [13] pass1/eval-macro-rhs [14] pass1/let-syntax [15] pass1/let-syntax [16] with-error-handler [17] dynamic-wind [18] eval [19] #f src: ((current-evaluator) form interactive-environment) "/usr/local/share/sagittarius/0.7.8/lib/sagittarius/interactive.scm":145 [20] with-error-handler ... (more stack dump truncated)
-
repo owner The fix contains the change of precompiled files, so If you applied patch to released tar ball, then you need to re-generate them with the following command (must be in the source directory):
$ ./dist.sh precomp
-
reporter Thanks, that makes progress but it still has problems in libraries:
$ sash -r7 -S.sld -L/path/to/chibi/lib -I'(chibi show base)' Unhandled exception Condition components: 1. &compile program: (import |(chibi show base)|) source: #f 2. &compile program: (define-library (chibi show base) (export show fn fn-fork wi source: "/Users/foof/src/chibi-scheme/lib/chibi/show/base.sld":2 3. &compile program: (syntax-rules ::: () ((fn ("step") (params :::) ((p param) . source: syntax-rules:(:: () ((f! (step) (params ::) ((p param) . rest) . body) (f! (step) (params :: (p param)) rest . body)) ((f! (step) (params ::) ((param) . rest) . body) (f! (step) (params :: (param param)) rest . body)) ((f! (step) (params ::) (param . rest) . body) (f! (step) (params :: (param param)) rest . body)) ((f! (step) ((p param) ::) () . body) (lambda (st) (let ((p (ask st 'param)) ::) ((let () . body) st)))) ((f! params . body) (f! (step) () params . body))) 4. &assertion 5. &who car 6. &message "pair" required, but got () 7. &irritants () 8. &stack-trace
It looks like ::: is still being interpreted as a keyword. Replacing it with ooo works fine, so for now I'll use that as a workaround.
-
repo owner If the
:::
is defined in other library, then it would raise an error since default reader reads:::
as a keyword.NOTE:
.sld
is supported by default and R7RS reader is used to read files whose suffix are.sld
. So removing-S.sld
options would help. - Log in to comment
Thank you for the report!
Assume the script uses
(scheme base)
not(rnrs)
. The result seemed fine to me, but I've got an error during expansion when I executed without-r7
option. This is because:::
is read as a keyword not a symbol.Other error also occurred on REPL, this is because REPL automatically imports
(rnrs)
but(scheme base)
. This needs to be fixed.