Thinking about operators for functions that require particular types
(like numeric types for numeric ops), I am thinking there is no way to
get compile time checking of types. In other words, if you can do
something like:
Function<X,Integer> f =
functionFor( callsTo(X.class).someIntMethod() ).plus(3);
then what would prevent something like the following from also
compiling:
Function<X,Integer> f =
functionFor( callsTo(X.class).someNonNumericMethod() ).plus(3);
Yes, we could have runtime checking, but that would be less pleasant.
I think the same goes for the alternate parameterized form, but I will
have to ponder that further.