3 ms·
Yeah, that's very true. Try and do FP in Java or C++ or PHP or Python and see where it gets you. And before I get a ton of "ackchyally you can do X" guys, yes
by pdimitar 5y ago
Yeah, that's very true. Try and do FP in Java or C++ or PHP or Python and see where it gets you.
And before I get a ton of "ackchyally you can do X" guys, yes you technically can but there's friction and you are implicitly not encouraged to do so.
I like languages that push you to think about X or Y so you can't miss it. Case in point: strong static types in many languages, or lifetimes/ownership in Rust.
- deepsun 5y ago> I like languages that push you to think about X or Y so you can't miss it. Yet most modern languages steer away from checked exceptions, that you cannot miss. And I agree with them, catching UrlMalformedException from a hardcoded static url is unnecessary. But most importantly, checked exceptions just don't play well with FP, that's why they are getting pushed off the ship.
- AmpsterMan 5y agoI have such a weird relationship with checked exceptions in Java. I like checked exceptions because it makes exceptions part of the API. However, much of the time it's super intrusive and try-catch can be clunky. At this point I'm convinced there is no good solution from a language level for exceptions/errors. They just suck.
- valenterry 5y agoThe solution is already there. It's a combination of subtyping, union types, effect-handling and syntactic sugar for effect handling. checked exceptions would be fine id they were not so clunky.
- asddubs 5y agooh I don't think doing functional programming in PHP is all difficult/frictiony. C++ there's probably a bit more friction but if you're on a modern version it's also not too bad.
- Tozen 5y agoThis is a valid point. The culture of various languages forces their favorite paradigm. In the case of many class-based OOP languages (or those that have strongly adopted it), programmers can be publicly shamed and ridiculed for not writing class-based OOP libraries and programs. Even just using simpler objects can be frowned upon because its not using classes, even if it can be considered valid OOP too. This is why, unless forced or pressured to on a professional level, prefer dabbling in those languages where there is no classes or its truly an option, and not the main (forced) paradigm. Prefer less stress, hidden spaghetti code (pretending it's not), bullying, or shaming. Just way more enjoyable to write in languages where the paradigm that you choose is because it makes sense to solve the problem, not because "that's just what we do around here".
- jeltz 5y agoIn my experience the issue with doing e.g. FP in Python is that even if your own code is fine you probably want to use libraries which are not FP which will create a pretty jarring missmatch.
- pdimitar 5y agoYep, exactly that. Plus it's very likely everybody else in your companies is not writing FP Python so you'll be peer-pressured to stop because it confuses your colleagues during code reviews.