kawa-commonlisp-dev
[Top][All Lists]
Advanced

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

Re: [Kawa-commonlisp-dev] [GSoC] Status


From: Charles Turner
Subject: Re: [Kawa-commonlisp-dev] [GSoC] Status
Date: Fri, 10 Aug 2012 21:29:45 +0100

On 10 August 2012 19:46, Jamison Hope <address@hidden> wrote:
> The good news, though, is that it only goes through that lookup
> mechanism if the symbol isn't loaded yet, so if we explicitly load
> it by putting
>
> (require class::|gnu.commonlisp.lisp.primitives|)
>
> at the top of defmacro.lisp, then we're good to go:

Thanks again Jamison, really getting lost with this now though. There
appears to be a difference with how DEFINE-SYNTAX captures the symbols
used in its definition and how DEFMACRO does it. Don't know much about
hygiene, but maybe the problem is related to that:

The general problem can be seen by trying a macro like
DESTRUCTURING-BIND, which expands to functions not def*Fld'd from
CommonLisp:

#|kawa:1|# (destructuring-bind (a b c) '(1 2 3) (list c b a))
<unknown>: warning - no declaration seen for COMMON-LISP:PROPER-LIST-OF-LENGTH-P
<unknown>: warning - no declaration seen for COMMON-LISP:ARG-COUNT-ERROR
unbound location COMMON-LISP:PROPER-LIST-OF-LENGTH-P (property (function))

I made a smaller test case that, to me, demonstrates a hygiene problem:

$ cat test1.lisp
(module-export test)

(defun nonsense (x) (+ x 10))

(defmacro test ()
        `(nonsense 10))
$ bin/kawa.sh --clisp -C test1.lisp
(compiling test1.lisp to test1)
test1.lisp:1:1: warning - no use of NONSENSE ; I don't get such
warnings when compiling defmacro.lisp!
$ bin/kawa.sh --clisp
#|kawa:1|# (require class::|test1|)
#|kawa:2|# (test)
test1.lisp:6:12: warning - no declaration seen for COMMON-LISP:NONSENSE
test1.lisp:6:12: unbound location COMMON-LISP:NONSENSE
[ .. snipped ]
$ cat test2.lisp
(module-export test)

(defun nonsense (x) (+ x 10))

(define-syntax test
  (syntax-rules ()
    ((test) (nonsense 10))))
$ bin/kawa.sh --clisp -C test2.lisp
(compiling test2.lisp to test2)
$ bin/kawa.sh --clisp
#|kawa:1|# (require class::|test2|)
#|kawa:2|# (test)
20

Any pointers on where to look for the difference? I'm struggling to
figure out how where the bindings are actually looked up, and actually
I'm not sure if DEFMACRO is functioning correctly and that I must
instead use define-syntax.

Charles.



reply via email to

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