On Fri, Jun 10, 2011 at 6:14 PM, Robert Fischer <smokejumpe...@gmail.com> wrote: > 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?
filterArguments replaces the argument at the given offset with the result of the filter handle. It doesn't allow you to alter the return value of the target. filterReturn allows you to change the return value, but does not have access to arguments. > 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. foldArguments reinserts the results of passing all arguments to the folding handle back into the parameter list, but does not do anything to return value. So far I've not been able to come up with a way to alter the return value using the argument values. It only seems possible to do that with an intermediate Java call that wraps everything else, and I stil believe that defeats inlining the rest of the chain. - 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.