Re: Generic interfaces Per Bothner 24 Jul 2021 19:31 UTC


On 7/23/21 11:55 AM, Adam Nelson wrote:
> It seems like the intersection of the Java object system and the CLOS object system is... just the Java object system. CLOS is strictly more powerful (multimethods, runtime class updates, more dynamic typing) but it's also not portable to Kawa (or other Schemes based on OO platforms, like JavaScript or the CLR).

Of course Kawa *could* implement CLOS - but you'd have to do most of it by hand
without benefiting from the JVM performance optimizations.

Java 7 introduced MethodHandle and 'invokedynamic' which could be useful in
implementing CLOS-style method dispatch.  More recently GraalVM seems like it
could enable even deeper optimization possibilities.  However, I personally
don't have a good understandiing of invokedynamic and even less of GraalVM,
and don't have any plans to make use of them for Kawa.  It would probably
benefit Kawa to make use of invokedynamic for things like generic
arithmetic, but I don't have time to explore that.

(Kawa does make use of Java 7 Methodhandles, though.)

I think Kawa as it is occupies a nice sweet spot in terms of performance
and expressibility, but that may change as technology changes, and
there are certainly room for betterment.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/