Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> This set of changes allows Java to express one of the foundations of functional programming that the language never could before - Algebraic data types, along with idiomatic ways of using them.

And here I thought the foundation of functional programming was functions, which Java still doesn't have.

Seriously, functional programming is about functions, not types.



> functional programming is about functions

different people mean different things when referring to functional programming.

Some people believe that functional programming are using higher-order functions like `map`, `reduce`, `forEach`, etc, which takes a function as a parameter, instead of doing imperative loops.

Some people, in addition to above, believe that functional programming is about creating functions that take a certain 'shaped' parameters, to allow for automatic checking.

And lastly, the "real" functional programmers are people who believe in referential transparency in your functional program.


How is Math::sqrt not a function in Java? Sure, it’s called a static method and it lives in a class - but is it meaningfully different from the same being a function in a Math namespace in say, C++? You can static import it even and use it as a function. This is just needless hair splitting imo.


> And here I thought the foundation of functional programming was functions, which Java still doesn't have.

> Seriously, functional programming is about functions, not types.

Well it does have methods and it does have "Functions" (not to mention "Bifunctions", whatever those are). And there's certainly nonsense around exceptions and referring to outer variables. And no currying.

But if I understand you correctly, you real complaint is about not having effect-free functions, right? But then it becomes about the type system again, because that would be the mechanism to prevent effects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: