Re:C++11 and Boost - Succinct like Python
by huhtenberg on Wednesday October 31, 2012 @10:56AM
(#4723075)
I'm sorry, but as "succinct" as it is, this is basically an unreadable bullshit. Reminds me strongly of a macro abuse in C.
[ Parent
| on HN ]
Re:C++11 and Boost - Succinct like Python
by daivd on Wednesday October 31, 2012 @11:03AM
(#4723114)
It is only unreadable bullshit the first time you read it. If you use ranges, filtered and transformed for these kinds of tasks, it looks idiomatic.
Re:C++11 and Boost - Succinct like Python
by morsch on Wednesday October 31, 2012 @11:16AM
(#4723179)
Yep. It looked idiomatic to me -- and I don't even know C++11! I don't care for the unqualified access to join and transformed, though, even if it is more Pythonesque.
Re:C++11 and Boost - Succinct like Python
by alpatters on Wednesday October 31, 2012 @12:24PM
(#4723603)
you might not like the syntax of this particular boost lib, but it bears no relation to macro abuse in C. For one it is strongly typed.
Of course it is unreadable if you don't know C++ or boost range. But it is not more complex than a python map or filter with a lambda, if you don't know python.
It is visibly worse than python. '|' - I thought that was bitwise or? - rather than an (admittedly technical) English word like 'map' or 'filter' (and '<<' has the same problem). 'transformed([](pv){...})' may be necessary for compatibility, but the brackets are harder to follow than 'transformed(lambda pv: ...)'. And the type declaration as "propMap::value_type" is just noise - it doesn't tell the reader anything about what the actual type is, and it isn't necessary for static typechecking either (it would be optional in a modern statically typed language e.g. Scala).