Re:Ranges, Code Quality, and the future of C++
by notacoward on Thursday December 27, 2018 @02:12PM
(#18771715)
"Following paragraphs" is an ambitious term for barely one line of text. You have claimed there is some unspecified promised land of reuse through unspecified transformations and combinations, but you really haven't shown anything that's not equally achievable with "mere" sequential application. It still looks like a matter of aesthetics - that you prefer a more syntax-laden functional style, but not one that's objectively better.
Re:Ranges, Code Quality, and the future of C++
by avmich on Thursday December 27, 2018 @02:23PM
(#18771801)
Let's define "objectively better" as "allowing to do A, then B as well as to do B, then A - rather than only allowing to do A, then B". Then composability - defined as "allowing to do A, then B as well as to do B, then A" - is objectively better than imperative style - defined as "only allowing to do A, then B".
In these terms it looks like a tautology. But the essense is still there - if for some reason you'd like to have a freedom of order of some transformations, you need composability, as an opposite to an approach which prescribes the order.
(Alright, this is C++ so there's a little bit of cost due to a tiny amount of extra 'syntax' where C++ imperative syntax is "free", but that's trivial for any but the most trivial of examples.)