5 ms·
Enough praise for FP. Now let's go back to real world. Please help tell me what's the best way to replicate what's good in OOP, like how to use FP to solve exp
by revskill 4y ago
Enough praise for FP. Now let's go back to real world.
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 ?
- panzerklein 4y agoExpression problem exists in both OOP and FP[1] [1] https://wiki.c2.com/?ExpressionProblem https://wiki.c2.com/?ExpressionProblem
- deltasevennine 4y agoOOP is a mass delusion not dissimilar to religion.
- deleted 4y ago[deleted]
- hither_shores 4y ago> like how to use FP to solve expression problem Some common approaches: - Tagless final style: https://okmij.org/ftp/tagless-final/ https://okmij.org/ftp/tagless-final/ - Datatype-generic programming: https://markkarpov.com/tutorial/generics.html https://markkarpov.com/tutorial/generics.html - Polymorphic records and variants: https://www.cl.cam.ac.uk/teaching/1415/L28/rows.pdf https://www.cl.cam.ac.uk/teaching/1415/L28/rows.pdf
- Twisol 4y agoI'm a very big fan of the "object algebras" approach [0], which is essentially tagless final minus the automatic instance resolution you get with typeclasses. It works great even in fairly restrictive type systems like Java's. [0]: https://www.cs.utexas.edu/~wcook/Drafts/2012/ecoop2012.pdf https://www.cs.utexas.edu/~wcook/Drafts/2012/ecoop2012.pdf
- BeetleB 4y agoI can understand the pushback against FP, but it doesn't follow that if FP is a poor choice, then the only realistic alternative is OOP. 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.
- iterati 4y agoThese are the dumbest type of comments. People are doing real world work in FP, but because it's not the work you do (or you're not comfortable doing the work you do in FP) you're deluded to thinking that no real work gets done in it.
- deltasevennine 4y agoHe's a Fullstack JS developer which is even dumber because he uses React which is basically the defacto JS front end framework. 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 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.