I have been trying to understand why the JDK 8 Lambda Expert Group (EG) decided not to include a new function type into the Java programming language.
Going over the mailing list I found a thread with the discussion about removal of function types.
Many of the statements are ambiguous to me, maybe because of the lack of context and in some cases because of my limited knowledge on the implementation of type systems.
However, there are a couple of questions that I believe I can safely formulate in this site to help me understand better what they meant.
I know I could ask the questions in the mailing list, but the thread is old and all decisions are already made, so chances are that I will be ignored, above all seeing that these guys are already getting delayed with their plans.
In his answer to support the removal of function types and endorse the use of SAM types, Brian Goetz says:
No reification. There was a long thread about how useful it would be for function types to be reified. Without reification, function types are hobbled.
I couldn't find the thread he mentions. Now, I can understand that the introduction of a structural function type may imply certain complications in the Java mostly nominal type system, what I cannot understand is how parametrized SAM types are different in terms of reification.
Aren't they both subject to the same reification problems? Does anyone understands how function types are different than parametrized SAM types in terms of reification?
In another comment Goetz says:
There are two basic approaches to typing: nominal and structural. The identity of a nominal is based on its name; the identity of a structural type is based on what it is composed of (such as "tuple of int, int" or "function from int to float".) Most languages pick mostly nominal or mostly structural; there are not a lot of languages that successfully mix nominal and structural typing except "around the edges." Java is almost entirely nominal (with a few exceptions: arrays are a structural type, but at the bottom there is always a nominal element type; generics have a mix of nominal and structural too, and this is in fact part of the source of many of people's complaints about generics.) Grafting a structural type system (function types) onto Java's nominal type system means new complexity and edge cases. Is the benefit of function types worth this?
Those of you with experience in the implementation of type systems. Do you know any examples of these complexities or edge cases that he mentions here?
Honestly I get confused by these allegations when I consider that a programming language like Scala, which is entirely based on the JVM, has support for structural types like functions and tuples, even with the reification problems of the underlying platform.
Don't get me wrong, I am not saying that a function type should be better than the SAM types. I just want to understand why they took this decision.