3 ms·
A discussion about "proper functional programming" is not particularly relevant, because the topic is functional programming in the context of C++. The constru
by blub 10y ago
A discussion about "proper functional programming" is not particularly relevant, because the topic is functional programming in the context of C++.
The constructs that C++ offers for FP are not complicated.
- hellofunk 10y agoSorry, but this is just simply not true. If you've never done functional programming before, then I could see why you think doing it in C++ is not complicated. Here is an example of just how large the can of worms gets when attempting to bring functional programming to C++: https://bartoszmilewski.com/2013/11/13/functional-data-structures-in-c-lists/ https://bartoszmilewski.com/2013/11/13/functional-data-struc... and: https://bartoszmilewski.com/2013/11/25/functional-data-structures-in-c-trees/ https://bartoszmilewski.com/2013/11/25/functional-data-struc... And, I disagree that you can change the definition of a particular programming paradigm when discussing a particular language. Functional programming means something that is not really possible in C++. For starters, the fundamental underlying data structures for functional programming do not exist in C++ and there is no third-party implementation of them worth mentioning; the above experiment is admitted by the author to fall flat when doing anything idiomatic. As I mentioned before, C++20 might turn the tide on this front a little bit, thanks to the Range library.
- blub 10y agoFine, what shall we call this programming style in C++ (lambdas, immutability, function composition, etc) so that everyone is happy then? Functional style C++? I haven't felt the need to go deeper than that, it's very possible that I've missed many interesting things, but it's not clear that I can use those things and see tangible benefits in my projects today.