[Top][All Lists]

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

Re: [patch] variable datums with syncase transformer

From: Ludovic Courtès
Subject: Re: [patch] variable datums with syncase transformer
Date: Wed, 05 Mar 2008 15:59:37 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


I just rediscovered this message, sorry for the long delay.

Stephen Compall <address@hidden> writes:

> Issue most easily explained with a simple reproduction:
> guile> (use-syntax (ice-9 syncase))
> guile> (@ (guile) car)
> ERROR: invalid syntax #<variable b7c50a40 value: #<primitive-procedure car>>

OTOH, you can (should?) use `use-modules':

  guile> (use-modules (ice-9 syncase))
  guile> (define-syntax foo (syntax-rules () ((_ x ...) (x ...))))
  guile> foo
  #<macro! sc-macro>
  guile> (foo + 2 3)
  guile> (@ (guile) car)
  #<primitive-procedure car>

I don't even understand what the difference is between using
`use-modules' and `use-syntax' for `(ice-9 syncase)'.  There's this
`expansion-eval-closure' fluid that's being used, but it doesn't seem to
change the module where top-level bindings are resolved, as one might

  guile> (define-module (x) :use-syntax (ice-9 syncase))
  #<directory (x) b7a7d110>
  guile> (define (+ . args) 'plus)
  guile> (define-syntax foo (syntax-rules () ((_ x ...) (+ x ...))))
  guile> (export-syntax foo)
  guile> (foo 1 2 3)
  guile> (set-current-module (resolve-module '(guile-user)))
  #<directory (x) b7a7d110>
  guile> (use-modules (x))
  guile> (foo 1 2 3)
  6   ;; <--- `+' is resolved in `(guile-user)', not in `(x)'

This per-module syntax transformer, `use-syntax' and friends all look
pretty pointless to me.


reply via email to

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