unofficial mirror of 
 help / color / mirror / Atom feed
* Having trouble with syntax-source
@ 2022-04-22 16:51 Mitchell Kember
  0 siblings, 0 replies; only message in thread
From: Mitchell Kember @ 2022-04-22 16:51 UTC (permalink / raw)
  To: guile-user


I'm having trouble using syntax-source in a macro.

Here's what I have:

    (import (rnrs (6)))
    (define-syntax foo
      (lambda (x)
        (syntax-case x ()
          ((_ e)
             (display (syntax-source #'e))
             #'(display (syntax-source #'e)))))))
    (foo (list 1))

Displaying the syntax-source works the first time during macro
expansion, but not the second time in the result of the macro:

    $ guile --no-auto-compile --r6rs
    ((filename . (line . 13) (column . 5))
    2 (primitive-load "/path/to/")
    In ice-9/eval.scm:
    191:35 1 (_ #f)
    In unknown file:
    0 (syntax-source (#<syntax list> #<syntax 1>))

    ERROR: In procedure syntax-source:
    In procedure syntax-source: Wrong type argument in position 1
(expecting syntax object): (#<syntax list> #<syntax 1>)

I've tried the same thing in Racket and Chez Scheme and it works fine there:

Is there some way to fix it for Guile? (Ideally in a way that also
works for Racket and Chez, since I'm in a codebase that targets all of


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-22 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 16:51 Having trouble with syntax-source Mitchell Kember

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