This is the mail archive of the kawa@sources.redhat.com 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: Kawa-1.7beta1 available


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/



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