7 ms·
Well, are you suggesting that a real C++ developer wouldn't think it is a good idea to include a library or framework in his program? (because 156 lines of extr
by GreaterFool 12y ago
Well, are you suggesting that a real C++ developer wouldn't think it is a good idea to include a library or framework in his program? (because 156 lines of extra code is too much?)
Have you ever used STL? It is full of template classes! It is a LOT of code in there.
The author implemented a stream processing framework based on lazy evaluation and an interface taken straight out of functional programming (Haskell) approach.
Tidy it up, make it more robust and why wouldn't it be industry strength and ready for production code?
#include <lazy_streams>
//3 lines of code to implement the original problem
What would be wrong with that?
I think C++ more than (m)any other language(s) sufferes from not-invented-here syndrome. If something is not in core language or STL then it might as well not exist -- people will always do their own thing from scratch. Or you grab some behemoth library like Boost which should cater to all your needs.
In contrast in Haskell/OCaml/Clojure (probably others too but those I'm most familiar with) one can download a tiny library that allows to radically change the control flow of the program.
What's demonstrated here is one such thing. It is based on sound principles (monads, functors...) and lazy streams which is a very well researched topic.
Sure, this is C++ we are talking about and there sure will be dragons somewhere. But if Bartosz ever dedicates his time to make a full fledged and tested library I will be damn sure to use it!
- jejones3141 12y agoI would have to disagree. C++ is the opposite of NIH; it's a kitchen sink programming language.