public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Sudarshan S Chawathe <chaw@eip10.org>, Sonny To <son.c.to@gmail.com>
Cc: Kawa mailing list <kawa@sourceware.org>
Subject: Re: using lambda to implement one method interface
Date: Mon, 18 Sep 2017 14:24:00 -0000	[thread overview]
Message-ID: <b5f88b6b-7138-1052-646f-e87e6ca4dc98@bothner.com> (raw)
In-Reply-To: <22802.1505733729@vereq.eip10.org>

On 09/18/2017 04:22 AM, Sudarshan S Chawathe wrote:
>> how would I implement an interface with multiple methods?
> 
> 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.

Not sure I understand what you mean by that.

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.

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.

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â„¢ Virtual Machine Specification."

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.)
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

  reply	other threads:[~2017-09-18 14:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17 15:32 Sonny To
2017-09-17 15:38 ` Sonny To
2017-09-17 15:59   ` Per Bothner
2017-09-17 16:04     ` Sonny To
2017-09-17 16:50       ` Per Bothner
2017-09-17 18:54         ` Sonny To
2017-09-17 20:02           ` Per Bothner
2017-09-18  6:35             ` Sonny To
2017-09-18  8:17               ` Sonny To
2017-09-18 13:59                 ` Per Bothner
2017-09-18 11:22               ` Sudarshan S Chawathe
2017-09-18 14:24                 ` Per Bothner [this message]
2017-09-18 14:31                   ` Sudarshan S Chawathe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5f88b6b-7138-1052-646f-e87e6ca4dc98@bothner.com \
    --to=per@bothner.com \
    --cc=chaw@eip10.org \
    --cc=kawa@sourceware.org \
    --cc=son.c.to@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).