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

I don't understand the perceived antagonism. I like FP, I like OOP. Most of my objects immutable, and "change" methods return a new instance of the object with the expected change. It's a great way to code.


This is very close to writing FP code in an OOP language.

Immutability is more of a core FP concept, than an OOP one. I guess the point is the categorization of the language you're using doesn't necessarily commit you to programming in that paradigm.


I agree with you. What language are you doing this in?


Mostly Java, but also Typescript and Python. The only language I use professionally that seems actively antagonistic to FP is Go.

I do wish Java had made `final` the default for fields and variables. Lombok's `@Value @With` takes away a lot of the pain though.


Languages with immutability by default are the best. It's kinda like safe vs unsafe in Rust. You can do lots of things with immutability or safe Rust but when you need mutability or unsafe Rust then you just add the necessary keyword.

The "dangerous" parts of the application are now highly visible and neatly separated from the harmless parts.


I really wish Ceylon had taken off, it was (is?) a better "better Java" than Kotlin. Aside from having intersection and union types before typescript, everything was immutable by default... and you had to type out the full word `variable` if you wanted mutability.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: