This is the mail archive of the kawa@sourceware.org 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: easier Kawa object building with Swing example


* 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


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