3 ms·
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
by yareally 11y ago
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.
- mike_hearn 11y agoAlright, 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.