DSL for handle binding
Charles Oliver Nutter
headius at headius.com
Mon Mar 21 18:45:09 PDT 2011
On Mon, Mar 21, 2011 at 8:40 PM, John Rose <john.r.rose at oracle.com> wrote:
> Yes, that occurred to me to, at least in this form (which is not very statically checkable):
>
> Binder
> .from(String.class, "a", Integer.class, "b", Float.class, "c", String.class)
> .reorder("c", "c")
>
> It's a little harder to imagine unwinding everything to open code when name lookups are involved.
I've been thinking of ways to blunt the cost of the DSL as well. The
simplest would be saving the Binder before calling "invoke", since
from there on it can apply to anything with the same types. Another
might be having Binder emit code for the MethodHandles calls,
bypassing the normal logic...but of course now we're talking about
generating code to generate MH binding sequences :)
> One could also use a format-like string:
>
> Binder.lambda("(a,b,c) $1(c,$2,c)", target, new File("foo"));
>
> Paradoxically, that might be faster if there were an internal constructor cache keyed by format string.
A format string or markup system would be pretty slick. I'll have to
think about that a bit.
- Charlie
More information about the mlvm-dev
mailing list