Adventures in F#--Function Type Inference

Consider this F#:

let Reverse a b = b a

This means: given a and b (whatever they may be) call b as a function with 'a' as the argument. When I compile this and look at it under reflector I get:

    public static U Reverse <T, U>(T a, FastFunc<T, U> b)
        return b.Invoke(a);

Its interesting to me that F# is able to contextually deduce that b must be a function call.

That FastFunc<T,U> is not a delegate but it seems to represent a similar concept. I'm not sure why its not a delegate and this seems to limit interoperability with languages (like C#) which use delegates to represent this concept, note to self to investigate this later.

Another thought: That FastFunc is an abstract class means that the implementation of the function need not exist until its called. I don't think this is possible with straight delegates.

This posting is provided "AS IS" with no warranties, and confers no rights.