5 ms·
Most of that code is for optimization or error messages. I think you could strip it down to: auto for_each = [](R&& r, Fun fun) { return r | view::tr
by slavik81 8y ago
Most of that code is for optimization or error messages. I think you could strip it down to:
auto for_each = [](R&& r, Fun fun) {
return r | view::transform(fun) | view::join;
};
I also removed inline and constexpr because he didn't need them in his example.
I don't disagree that it's ugly, but it's not as bad as it looks when you go through the standard library. Those are functions that have been written, optimized and generalized to handle all sorts of cases. Your needs are almost certainly more specific, and you will undoubtedly write functions that are much simpler.
That being said, I kind of agree. I would have preferred your list of features to getting Concepts. I find SIMD to be a particular sore spot.
- spiritcat 8y agoDo c++ regulars eventually just get numb to how hideous the :: syntax is to look at?
- blattimwind 8y agoNot the worst piece of C++ syntax by various orders of magnitude.
- justAnotherNET 8y agoand what does that say?
- fermienrico 8y agoIt is as if we don't learn! Same thing in Rust. :: is adds so much visual noise. Julia is the only modern language with beautiful syntax. I think we should pay more attention to the aesthetics of a language just like we do with spoken languages. Certain languages just sound beautiful - Japanese and French. C++ is old but Rust could have paid more attention to subjective aspects of a language.
- deleted 8y ago[deleted]
- feanaro 8y ago> Certain languages just sound beautiful - Japanese and French You've managed to pick the two languages whose sound irritates me the most, which I think illustrates the fragility of this kind of thinking perfectly.
- klyrs 8y agoI haven't yet... but after I got a bug report for polluting namespaces with my library, I uglified my code like a good citizen.
- int_19h 8y agoI much prefer having separate operators for namespace/module qualification and member access. These things seem like they have something in common, but in practice, IMO, the languages that separate them are much cleaner. Whether :: specifically is the best choice of such an operator is another question. But there aren't exactly many options left, and this one is firmly established by now, even outside of C++.
- blattimwind 8y agoPHP was changed last minute to use \ which in my opinion is a way worse choice.
- int_19h 8y agoThat was a horrible choice if only because \ is already well-established for escape sequences (including in PHP itself).