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

Hybridization of object-oriented and functional approaches seems like a decent approach to theses problems.

> "Nearly all modern programming languages have some form of null references, shared global state, and functions with side effects..."

Which is to say, code is organized into discrete classes, instantiated as objects, but those objects only use the functional paradigm with respect to their bound functions, i.e. no side effects, no shared global state. Some sort of input validation and screening can be used with each to sanitize values and avoid null references. Then you have a collection of discrete modular elements which can be reasoned about or debugged independently.

Such classes would be essentially 'stateless' but you could have other classes that stored mutable state and were queried by the functional types, much like the application-database model:

> "The trend has been to keep stateless application logic separate from state management (databases): not putting application logic in the database and not putting persistent state in the application. As people in the functional programming community like to joke, “We believe in the separation of Church and state”"

https://ebrary.net/65011/computer_science/separation_applica...



> Hybridization of object-oriented and functional approaches seems like a decent approach to theses problems.

It's too complex and loses a lot:

> Contemporary imperative languages could continue the ongoing trend, embrace closures, and try to limit mutation and other side effects. Unfortunately, just as "mostly secure" does not work, "mostly functional" does not work either. Instead, developers should seriously consider a completely fundamentalist option as well: embrace pure lazy functional programming with all effects explicitly surfaced in the type system using monads.

https://m-cacm.acm.org/magazines/2014/6/175179-the-curse-of-...


Someone should bolt object-oriented features on top a functional programming language to see what it would look like. That would be an interesting research project. They could call it O-something and do a pun with an animal name.


Don’t need to, look at F#. Its functional first and OO is bolted on.


Now I'm stuck wondering if you missed the joke or are one upping me. Well done if it's the case.




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

Search: