bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[r6rs] probably bad syntax expansion


From: Marco Maggi
Subject: [r6rs] probably bad syntax expansion
Date: Mon, 21 Jun 2010 09:59:56 +0200

The following R6RS program:

(import (rnrs))

(define (%general-string-append . args)
  (let-values (((port getter) (open-string-output-port)))
    (let loop ((args args))
      (if (null? args)
          (getter)
        (let ((thing (car args)))
          (display (if (identifier? (car args))
                       (identifier->string (car args))
                     (car args))
                   port)
          (loop (cdr args)))))))

(define-syntax identifier->string
  (syntax-rules ()
    ((_ ?identifier)
     (symbol->string (syntax->datum ?identifier)))))

(define (identifier-prefix prefix identifier)
  (datum->syntax identifier (string->symbol (%general-string-append prefix 
identifier))))

(identifier-prefix "make-" #'salut)

fails with:

Backtrace:
In ice-9/boot-9.scm:
 170: 10 [catch #t #<catch-closure 8e80610> ...]
In unknown file:
   ?: 9 [catch-closure]
In ice-9/boot-9.scm:
  62: 8 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 389: 7 [eval # #]
In ice-9/boot-9.scm:
1858: 6 [save-module-excursion #<procedure 8f22840 at ice-9/boot-9.scm:1871:3 
()>]
1148: 5 [load "proof.sps" #f]
In unknown file:
   ?: 4 [load-compiled/vm 
"/home/marco/.cache/guile/ccache/2.0-0.R-LE-4/home/marco/var/tmp/proof.sps.go"]
In proof.sps:
  23: 3 [identifier-prefix "make-" #(syntax-object salut ((top)) ...)]
  12: 2 [%general-string-append "make-" #(syntax-object salut ((top)) ...)]
In ice-9/boot-9.scm:
 115: 1 [#<procedure 8d742f8 at ice-9/boot-9.scm:109:6 (thrown-k . args)> 
wrong-type-arg ...]
In unknown file:
   ?: 0 [catch-closure wrong-type-arg "vm-debug-engine" ...]

ERROR: In procedure vm-debug-engine:
ERROR: Wrong type to apply: #<syntax-transformer identifier->string>

on       a        i686-pc-linux-gnu       using       commit
8d10ccae79ff46f0ebea92ba36acfaebafba8d86;  I  get  the  same
error when precompiling and when not precompiling.

  If  I try  to reduce  the programs  to simpler  forms (for
example  simplifying %GENERAL-STRING-APPEND) the  error goes
away.

  The program works fine with other R6RS implementations.
-- 
Marco Maggi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]