How is the assignment itself implemented in terms of MethodHandles?
What do you have to work with?

What I'm thinking is that you could implement the side-effect as part
of a MethodHandles#filterArguments call (one that doesn't actually
change the argument)?  Just wrap that around a MethodHandles#identity
call. Won't that do it for you?

If you have the assignment implementation, but it returns
null/void/whatever, then use MethodHandles#foldArguments to insert a
second copy in front, and have the assignment be the map to the right.
I think that'll work.

~~ Robert.

On Fri, Jun 10, 2011 at 6:10 PM, Charles Oliver Nutter
<head...@headius.com> wrote:
> I have a case in JRuby where I need to return one of the incoming
> arguments as the result of the call, and I can't figure out how to do
> it with MethodHandle alone.
>
> Basically, any Ruby code that looks like this:
>
> a.foo = 'bar'
>
> ...or this:
>
> a[1] = 'bar'
>
> ...needs to return the RHS, not the result of the assignment call.
> Without invokedynamic I do this by passing my call site cache into
> another method that does the call and then just returns the RHS rather
> than the result of the call. I'm trying to formulate a set of
> MethodHandle transforms that will do the same thing without me
> introducing a piece of generalized Java code into the call path.
>
> I'd also like to avoid storing the RHS off into a temporary local
> variable, but I'll do that before I'll break inlining for the call
> itself by putting a piece of Java code in the call path.
>
> Thoughts?
>
> - Charlie
>
> --
> You received this message because you are subscribed to the Google Groups 
> "JVM Languages" group.
> To post to this group, send email to jvm-languages@googlegroups.com.
> To unsubscribe from this group, send email to 
> jvm-languages+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/jvm-languages?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com.
To unsubscribe from this group, send email to 
jvm-languages+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to