5 ms·
i think interactive applications are a good example we have what i consider 'a pile of hacks' (monad) in functional programming languages to handle these becau
by jheriko 13y ago
i think interactive applications are a good example
we have what i consider 'a pile of hacks' (monad) in functional programming languages to handle these because its very difficult to make useful software which doesn't allow user input. whilst being functional in some sense most of the usual benefits are undone and we are left effectively with imperative code written in a functional style.
however the libraries hide the implementation details for us...
personally though i don't think its as cut and dry as 'OO is good for X' or 'FP is good at Y'
OO and FP are tools that should sit with good ol' procedural programming, array programming and other paradigms - they all have their place, and languages with too much emphasis on one in particular end up with weird constructs to work around that.
I/O monads are an example for FP, but if we look at an OO language, say C#, we have static class as a way to turn an object into a bunch of free-floating state and stand-alone procedures - because sometimes /procedural/ is the only approach and we must shoehorn it into OO with singletons which usually incur a needless performance pain - the static keyword then hides that our object is actually a load of procedural code for us.
- dllthomas 13y agoMonad is a wonderful abstraction and not at all hacky. In my C, I miss the ability to parametrically combine "things that produce values".