Subject: Re: [boost] [optional] Safe optional
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-11-18 22:37:46
On 19/11/2014 14:32, Vladimir Batov wrote:
> While I agree with your point I suspect there might be something more
> fundamental why functional programming in C++ and functional programming
> in general has been on the fringes of and hardly present in mainstream
> commercial s/w development (not academia).
The main problem I think is just that functional programming is more
restrictive. At least in pure FP, your functions can only see their own
inputs and provide values by their direct outputs. Most "real" code is
messier than this -- you end up with containers of things and operations
on those things that may have side effects and working state, and often
end up hanging things off singletons.
Admittedly steering closer to functional ideals can lead to cleaner and
more-modular/less-coupled designs, but they're still a harder sell. IoC
frameworks usually try to do something similar at the object level
rather than the function level, and there are lots of people who don't
like IoC for much the same reason.
I also think that people are just more naturally wired to think in terms
of instruction sequences or recipes (imperative design) rather than
formulae (functional design).
Still, it's going to vary a lot by developer. Some people struggle with
SQL queries, which are also mostly a kind of FP, while others are masters.