From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31182 invoked by alias); 18 Sep 2017 14:31:16 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 27503 invoked by uid 89); 18 Sep 2017 14:31:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=sight, Hx-languages-length:1760 X-HELO: homiemail-a23.g.dreamhost.com Received: from sub3.mail.dreamhost.com (HELO homiemail-a23.g.dreamhost.com) (69.163.253.7) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Sep 2017 14:31:12 +0000 Received: from homiemail-a23.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTP id A6B0E4B006A; Mon, 18 Sep 2017 07:31:10 -0700 (PDT) Received: from vereq.eip10.org (cpe-74-75-122-130.maine.res.rr.com [74.75.122.130]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: chaw@eip10.org) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPSA id 5D2EF4B0062; Mon, 18 Sep 2017 07:31:10 -0700 (PDT) Received: from chaw by vereq.eip10.org with local (Exim 4.84_2) (envelope-from ) id 1dtx4k-0007X3-9R; Mon, 18 Sep 2017 10:31:06 -0400 To: Per Bothner cc: Sonny To , Kawa mailing list Subject: Re: using lambda to implement one method interface From: "Sudarshan S Chawathe" Reply-To: "Sudarshan S Chawathe" In-reply-to: Your message of "Mon\, 18 Sep 2017 07\:22\:56 -0700." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Sep 2017 14:31:00 -0000 Message-ID: <28956.1505745066@vereq.eip10.org> X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00069.txt.bz2 Mea culpa. I temporarily lost sight of the fact that the discussion was in the context of a REPL on Android. -chaw > Subject: Re: using lambda to implement one method interface > Cc: Kawa mailing list > From: Per Bothner > Date: Mon, 18 Sep 2017 07:22:56 -0700 >=20 > On 09/18/2017 04:22 AM, Sudarshan S Chawathe wrote: > >> how would I implement an interface with multiple methods? > >=20 > > I have found that simply defining the methods required by an interface > > (with the proper names and type signatures) works, in the sense that the > > resulting objects can be used anywhere that requires objects > > implementing the interface. >=20 > Not sure I understand what you mean by that. >=20 > The problem is defining an instance of an interface: > (1) with multiple methods; > (2) on-the-fly, in a REPL; > (3) on Android, which doesn't (didn't?) have ClassLoader.defineClass. >=20 > It should be possible to generalize gnu.kawa.reflect.ProceduralProxy > to handle multiple methods and corresponding implementing procedures. > The tricky is specifying which method is implemented by which procedure. >=20 > Perhaps problem (3) above is no longer a problem, at least on Android 8. > https://developer.android.com/reference/java/lang/ClassLoader.html > says that the byte array to defineClass "should have the format of a valid > class file as defined by The Java=E2=84=A2 Virtual Machine Specification." >=20 > So maybe we need to update the compilerAvailable test in ModuleExp.java. > If we now can generate classes on-the-fly then that removes a major > limitation of Kawa on Android. (At least on newer Android versions.) > --=20 > --Per Bothner > per@bothner.com http://per.bothner.com/ >=20