This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Kawa-1.7beta1 available
- From: Per Bothner <per at bothner dot com>
- To: Bruce Lewis <brlewis at ALUM dot MIT dot EDU>
- Cc: kawa at sources dot redhat dot com
- Date: Sat, 17 May 2003 12:42:42 -0700
- Subject: Re: Kawa-1.7beta1 available
- References: <3E67C808.1070800@bothner.com><nm9llxa62bw.fsf@buzzword-bingo.mit.edu>
Bruce Lewis wrote:
Here is some code that crashes kawa.repl with a "no such class" error:
(define (my-fun arg)
(+ arg 1))
(define (my-other-fun)
""
(let ((a 1))
(map my-fun '(1 2 3))))
This crashed because it treats the "" as a return type specifier.
I changed the syntax so it no longer does that. You can now
write:
(define (...) :: <TYPE> ...) ;; preferred
or
(define (...) <TYPE> ...)
or
(define (...) :: "TYPE" ...) ;; deprecated
but not
(define (...) "TYPE" ...)
The latter "TYPE" is now treated as an (ignored) expression.
(Common Lisp and Emacs Lisp traditionally treat these as
documentation comments.)
I also changind the compiler to check that TYPE
exists (if it isn't visible in the lexical scope).
Here is a function that throws a NullPointerException when it should
just return #t:
(define test1
(lambda ()
(define (some? pred? alist)
(cond
((null? alist) #f)
((pred? (car alist)) #t)
(else (some? pred? (cdr alist)))))
(display "")
(define (clicked? button)
(not (null? button)))
(define (some-clicked? buttons)
(some? clicked? buttons))
(some-clicked? '(#t #t #f ()))
(some-clicked? '(#t #t #f ()))))
This isn't valid Scheme. It works if you move the
nested function definitions to the beginning:
(define test1
(lambda ()
(define (some? pred? alist)
(cond
((null? alist) #f)
((pred? (car alist)) #t)
(else (some? pred? (cdr alist)))))
(define (clicked? button)
(not (null? button)))
(define (some-clicked? buttons)
(some? clicked? buttons))
(display "")
(some-clicked? '(#t #t #f ()))
(some-clicked? '(#t #t #f ()))))
It would be nice to have the original program
work. I do have a patch which seems to fix the
problem, but unfortunately it breaks other things
and I haven't been able to get a working fix yet.
--
--Per Bothner
per@bothner.com http://per.bothner.com/