easier Kawa object building with Swing example

Helmut Eller eller.helmut@gmail.com
Tue Oct 5 10:40:00 GMT 2010


* Per Bothner [2010-10-01 15:47] writes:

> Two more new features: First "SAM-conversion" is applied when a
> lambda expression is provided in a context that requires a "SAM type",
> which is an interface or abstract class with a single abstract method.
> For example java.lang.Runnable or many XxxListener classes.
> In that case an anonymous class is created.

This doesn't seem to work threads:

(define (foo)
  ((java.lang.Thread (lambda () 
		       (format #t "foo\n") 
		       (force-output))
		     "foo"
		     ):start))
(foo)

=> Argument #1 (#<procedure /dev/stdin:52>) to
'java.lang.Thread.<init>(java.lang.Runnable,java.lang.String)' has wrong
type (gnu.expr.ModuleMethod) (gnu.expr.ModuleMethod cannot be cast to
java.lang.Runnable)

Helmut



More information about the Kawa mailing list