4 ms·
As long as people don't abuse that power and don't write C++ code, full of statefull functors (intellegent fools they are, the worst kind), I'm happy.
by dchichkov 14y ago
As long as people don't abuse that power and don't write C++ code, full of statefull functors (intellegent fools they are, the worst kind), I'm happy.
- beagle3 14y agoThis. 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.
- laureny 14y ago> full of statefull functors (intellegent fools they are, the worst kind), I'm happy. If you are going to be judgmental and calling people fools, I suggest improving your spelling first, or you'll just appear to be one yourself.
- dchichkov 14y agoYes, I think you are right. My language was not precise enough. I wanted to describe a coder with little experience; tendency to overdesign; tendency to use 'design patterns' with no reason; tendency to build very elaborate designs; tendency to use the same pattern everywhere. I think that "intelligent fool" and maybe "baby with a hammer" fit that description. As to spelling errors, I'd suggest to try ignoring these and try to get the gist instead. Quite a few people here (including me) are not native English speakers.
- tikhonj 14y ago"Functor" in Haskell has a very different meaning from "functor" in C++. In Haskell, a functor (loosely speaking) is any type you can map a function over--lists, trees, options, functions... If you squint, they're similar (but simpler and more general) to types that can be iterated over.