unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [r6rs] probably bad syntax expansion
@ 2010-06-21  7:59 Marco Maggi
  2010-06-21  8:02 ` Marco Maggi
  2010-06-21 19:24 ` Andy Wingo
  0 siblings, 2 replies; 5+ messages in thread
From: Marco Maggi @ 2010-06-21  7:59 UTC (permalink / raw)
  To: bug-guile

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-08 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21  7:59 [r6rs] probably bad syntax expansion Marco Maggi
2010-06-21  8:02 ` Marco Maggi
2010-06-21  8:34   ` Marco Maggi
2010-06-21 19:24 ` Andy Wingo
2010-08-08 10:41   ` Andy Wingo

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).