public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Duncan Mak <duncanmak@gmail.com>
To: Per Bothner <per@bothner.com>
Cc: kawa mailing list <kawa@sourceware.org>
Subject: Re: Using environment-bound? in macro definitions
Date: Wed, 04 Jan 2017 02:41:00 -0000	[thread overview]
Message-ID: <CABgWrqoXJs_Oijp8PYXn+vjUvQN2vKcSQ20NqZXjTwHD9JQ+UA@mail.gmail.com> (raw)
In-Reply-To: <CABgWrqp1LO93SUOR0H4_zQTv4KbcxrfLbN4HWQjoJv2jxBiUvg@mail.gmail.com>

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.

  reply	other threads:[~2017-01-04  2:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 23:30 Duncan Mak
2017-01-03 15:46 ` Per Bothner
2017-01-03 22:06   ` Duncan Mak
2017-01-04  2:41     ` Duncan Mak [this message]
2017-01-04  4:33       ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABgWrqoXJs_Oijp8PYXn+vjUvQN2vKcSQ20NqZXjTwHD9JQ+UA@mail.gmail.com \
    --to=duncanmak@gmail.com \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).