Please help tell me what's the best way to replicate what's good in OOP, like how to use FP to solve expression problem ?
Please help tell me what's the best way to replicate what's good in OOP, like how to use FP to solve expression problem ?
Some common approaches:
- Tagless final style: https://okmij.org/ftp/tagless-final/
- Datatype-generic programming: https://markkarpov.com/tutorial/generics.html
- Polymorphic records and variants: https://www.cl.cam.ac.uk/teaching/1415/L28/rows.pdf
[0]: https://www.cs.utexas.edu/~wcook/Drafts/2012/ecoop2012.pdf
I do a lot of Python stuff - much of it is not functional programming. And very little of it is OOP.
The programming world doesn't consist of just these.
React is trending heavily away from OOP, it's creators heavily buy into FP, and most of the patterns in react are inspired heavily by FP. Functional components are now the way to go.
ReasonML (a pure FP language) is react as intended and is the northstar of React.
To learn more here is a video from Jordan Walke creator of React (and ReasonML): https://www.youtube.com/watch?v=5fG_lyNuEAw
I recommend parent commenter to learn more about the very tools he himself works with before disparaging FP and himself.