This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using environment-bound? in macro definitions


Hello Per,

I just noticed that if I put my macros inside a R7RS define-library,
then it get these warnings:

(define-library (foo)
  (export define-foo define-bar)
  (import (kawa base) (kawa lib syntax))
  (begin
    (define-for-syntax known (list))
    (define-syntax define-foo
      (lambda (stx)
        (syntax-case stx ()
          ((define-foo a)
           (begin
             (set! known (cons (list #'a 0) known))
             #'(define a (list)))))))

    (define-syntax define-bar
      (lambda (stx)
        (syntax-case stx ()
          ((define-bar a n)
           (identifier? #'a)
           (if (assoc #'a known)
               #'(set! a (cons n a))
               #'(begin
                   (define-foo a)
                   (set! a (cons (list n 0) a))))))))))


(import (foo) (srfi 64))

(test-begin "t")
(define-foo x)
(test-equal '() x)
(define-bar x 1)
(test-equal '(1) x)
(test-end)

$ kawa test.scm

test.scm:13:14: warning - no declaration seen for known
test.scm:13:45: warning - no declaration seen for known
test.scm:21:27: warning - no declaration seen for known

%%%% Starting test t  (Writing full log to "t.log")

# of expected passes      2

It'd be nice if there's a way to not have warnings show up.

Thanks again!


Duncan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]