Named function types


#1

I came across a statement in a response to a stack overflow question that “named function types” will be added to the ‘next’ kotlin release (as at Sep 2015).

The stack overflow post was http://stackoverflow.com/questions/26507099/lambda-expressions-in-kotlin - the reference to named function types was in the following response: “Named function types are a different story. And they will be supported in the next version of Kotlin – Andrey Breslav Sep 24 '15 at 17:41”.

I cannot find any mention to “named function types” and kotlin, either in the blog, posts in this discussion forum or on the wider internet. It may be that the feature has been called something else - or that I didn’t do my searches very well.

Are “named function types” already supported (perhaps under some other name)? If not, will they be supported one day?


#2

There is no support for named function types, under any name, in Kotlin 1.0. In Kotlin 1.1, we plan to support type aliases, which will allow you to assign a different name to any type, including function types.


#3

Will there be a way to create alias which have different erasure than the aliased types? (Well I guess that makes them not really aliases anymore.) It’s the same distinction as between type and newtype in Haskell.

Something like creating an anonymous empty subclass with the same constructors and type parameters.


#4

Maybe. We don’t have a full design for the feature at this time.