DSL for handle binding

John Rose john.r.rose at oracle.com
Mon Mar 21 18:40:00 PDT 2011


On Mar 21, 2011, at 6:13 PM, Charles Oliver Nutter wrote:

> Binder
>    .from(returns(String.class), arg("a", Integer.class), arg("b",
> Float.class), arg("c", String.class)
>    .reorder("c", "c")

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.

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.

-- John


More information about the mlvm-dev mailing list