3 ms·
This. A lot of Haskell's power comes from it being able to enforce the validity of this style of programming. C++ does not - and when working with C++, you hav
by beagle3 14y ago
This.
A lot of Haskell's power comes from it being able to enforce the validity of this style of programming. C++ does not - and when working with C++, you have to reason at both the C++ level like you always do, and at the Haskell level (but without the compiler verifying your work).
That's extra burden without extra benefits.
- dchichkov 14y agoIt is just that author in the "Container Operations" says that using functors in C++ is such a good practice. No. While concept is nice, in practice, with C++ it can result in time waste and unreadable/unmodifiable code with no clear benefits. Cleaning up some statefull functors overdesigned by some intellegent fool can be a gruesome job.
- laureny 14y ago> Cleaning up some statefull functors This makes no sense at all. A functor is a type class, it doesn't contain any state.
- wonderzombie 14y agoIn Haskell, it makes no sense, agreed. In C++, it makes sense: http://www.sgi.com/tech/stl/functors.html http://www.sgi.com/tech/stl/functors.html. Functors are function objects, which is to say they're a class/struct with one method, operator(). If this makes you sigh, know that you're not alone.