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: using lambda to implement one method interface


yes that was an error. copy and paste of testing code.  how would I
implement an interface with multiple methods?


On Sun, Sep 17, 2017 at 11:02 PM Per Bothner <per@bothner.com> wrote:

> On 09/17/2017 11:54 AM, Sonny To wrote:
> > this is a big problem for my use case...
> >
> > i wouldn't be able to do something like this on android at runtime
> >
> > (object (java.lang.Runnable)
> > ((run (a ::void))::void
> >           (+ 1 1)
> >           ))
>
> You can probably work around it with:
>
> (->java.lang.Runnable
>    (lambda ()::void (set! i (+ i 1))))
>
> BTW - I assume (a ::void) is just a typo.  Kawa should probably complain
> about it.
> --
>         --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]