guile-user
[Top][All Lists]
Advanced

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

(ice-9 syncase)


From: Andy Wingo
Subject: (ice-9 syncase)
Date: Mon, 04 Oct 2004 22:18:26 +0200

Hey all,

I've been having some problems lately with syncase macros and modules.

Now, a specific problem that completely stumps me. I am getting SSAX to
work with r5rs macros. Part of SSAX's API are a set of macros to create
custom SAX parsers. They don't work, though:

guile> ssax:make-parser
$1 = #<macro! sc-macro>
guile> (ssax:make-parser)
ERROR: invalid syntax (find k-args (DOCTYPE . default) DOCTYPE val . others)
ABORT: (misc-error)

This same code me a more proper error about not putting the right
arguments if I put myself in the (sxml ssax) module first.

This error isn't very informative due to syncase stack cutting.
ssax:make-parser is a macro made by another macro, ssax:define-labeled-
arg-macro, which is also exported, and it starts off like this:

(define-syntax ssax:define-labeled-arg-macro
  (syntax-rules ()
    ((ssax:define-labeled-arg-macro
       labeled-arg-macro-name
       (positional-macro-name
         (arg-name . arg-def) ...))
      (define-syntax labeled-arg-macro-name
        (syntax-rules ()
          ((labeled-arg-macro-name . kw-val-pairs)
            (letrec-syntax
              ((find 
                 (syntax-rules (arg-name ...)
                 [...]

The interesting thing is that `find' is actually a local syntactic
binding. I could maybe understand if find were a toplevel binding, then
one would expect information about it to be stored in the module
somewhere (apparently on the variable). However, it's not toplevel.
Perhaps this is affected by the note on psyntax.ss:203:

;;; "let-syntax" and "letrec-syntax" are also treated as splicing
;;; constructs, in violation of the R4RS appendix and probably the R5RS
;;; when it comes out.  A consequence, let-syntax and letrec-syntax do
;;; not create local contours, as do let and letrec.  Although the
;;; functionality is greater as it is presently implemented, we will
;;; probably change it to conform to the R4RS/expected R5RS.

However, the `find' symbol is bound to a procedure within (sxml ssax).

I don't know what's going on here. Any ideas? Now I have to do crappy
things like

(use-modules (sxml ssax))
(define-module (sxml ssax))

to use these macros.

Thanks in advance,
-- 
Andy Wingo <address@hidden>
http://ambient.2y.net/wingo/




reply via email to

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