I spent some time looking at Java's invokedynamic. Like all recent software, this appears to me to be incomprehensible garbage. Consider this Luan code:
local function add(x,y)
return x + y
end
For the Luan programmer, x and y are probably numbers, or maybe tables with metamethods. But from Java, x and y are numbers of several different possible types. It would be nice to be able to easily handle each case, so that for example, if x and y are both of type Integer, then I just add ints and return an Integer.
This is the kind of thing I assumed invokedynamic would be for. But apparently not since an invokedynamic call includes a constant method signature. So what is the point of invokedynamic if one call can't handle different types? I have no idea.
I read a number of articles about invokedynamic, found from Google. All are horribly written, unsurprisingly. They all say how great invokedynamic is and then jump into meaningless details without giving the big picture of how invokedynamic works. I worked/suffered my way through these stupid details and never got the point of the whole thing. So I just assume it is crap, as all modern software is. If this is wrong, I welcome an explanation.