Re:Kotlin: A New Hope in a Java 6 Wasteland
by yareally on Monday September 28, 2015 @09:47PM
(#10294304)
Technically first class functions means functions can be treated like objects and passed around like any object (for example, python).
That said, I agree with you that Java does not have first class functions. They have something tacked on that is nowhere as elegant and lacks full support.
On the other hand, not every language that lets you define functions outside of classes lets you treat them like objects. C for example is generally not considered a language with true first class functions because it doesn't allow passing nested ones without additional support within the chosen complier.
Re:Kotlin: A New Hope in a Java 6 Wasteland
by mike_hearn on Tuesday September 29, 2015 @07:20AM
(#10295559)
Alright, in that case Kotlin has that other sense of first class functions as well. You can get a function typed object that supports the invoke operator, amongst other things.
Kotlin has quite a lot of hidden treasures in it, typically at the intersection points of several features. People who think of it as a better Java, or something Java can easily catch up with, should take a closer look.