DSL for handle binding

Rémi Forax forax at univ-mlv.fr
Mon Mar 21 18:09:16 PDT 2011


On 03/22/2011 02:04 AM, Charles Oliver Nutter wrote:
> Interesting...I think you're the only one :) (or at least, you're the
> only one I know of)
>
> It seems much easier for me to read forward:
>
> On Mon, Mar 21, 2011 at 5:48 PM, Rémi Forax<forax at univ-mlv.fr>  wrote:
>>>           MethodHandle handle = Binder
>>>                   .from(String.class, Integer.class, Float.class, String.class)
> ...starting with (String, Integer, Float)String
>>>                   .drop(0, 2)
> ...drop at index zero, two elements, producing (String)String
>>>                   .reorder(0, 0)
> ...use element 0 twice, producing (String, String)String
>>>                   .invoke(target);
> ...invoke from this point
>
>> Am I the only one to have the brain wired backward ?
>> To understand your first example, I had to read your binder from the bottom
>> to the top.
>> I hope that's because I'm used to use the mh API.
> Permute is especially confusing (to me) because you're not permuting
> the arguments of the target handle, you're permuting incoming
> arguments based on a method type so that they match the target handle.
> Specifying the incoming handle is perhaps the most cumbersome part,
> and that disappears completely in the above example (since it can be
> determined from the previous calls).
>
> And then when combining multiple handles that all have to go backward,
> I often (usually!) forget what indices I should be using, what the
> handle type is at various points, and so on. The above example flows
> more naturally (to me!) with incoming arguments being massaged toward
> an eventual target.
>
> - Charlie

My first version of PHP.reboot use some permutations
but after a blackboard session with myself, I was able to remove all of 
them.

Of course, it's easier if you don't have an existing base of codes.

Rémi



More information about the mlvm-dev mailing list