Re:The Go Programming Language, or: Why all C-like languages...
by shin_lao on Wednesday June 08, 2011 @01:14PM
(#2634031)
I rarely use the "for" or "while" keywords. I use the algorithms instead.
The containers have been designed with this is mind.
If you don't use the algorithms, indeed, the STL can be cumbersome to use.
Re:The Go Programming Language, or: Why all C-like languages...
by rayiner on Wednesday June 08, 2011 @03:00PM
(#2634532)
The algorithms are a PITA without lambdas, and are not easily composable or extensible to express more complex iteration. None of them can work with multiple containers, which makes writing even something as simple as a "zip" function using the algorithms an exercise in futility.
Re:The Go Programming Language, or: Why all C-like languages...
by jamesaguilar on Wednesday June 08, 2011 @02:01PM
(#2634237)
But then you have to define the loop internal logic elsewhere because C++ has no lambda (yet, at least in most places where it's used in production). God help you if you have a lot of variables that need to be compared or referenced inside the loop.
Re:The Go Programming Language, or: Why all C-like languages...
by shin_lao on Wednesday June 08, 2011 @04:42PM
(#2634943)
Without lambdas you use functors.
Re:The Go Programming Language, or: Why all C-like languages...
by jamesaguilar on Wednesday June 08, 2011 @06:41PM
(#2635309)
> then you have to define the loop internal logic elsewhere
Re:The Go Programming Language, or: Why all C-like languages...
by shin_lao on Thursday June 09, 2011 @02:09AM
(#2636209)
The loop is performed by the algorithms.
See std::for_each, std::transform, std::accumulate, std::partition, etc., etc.
Re:The Go Programming Language, or: Why all C-like languages...
by jamesaguilar on Wednesday June 08, 2011 @02:01PM
(#2634235)
But then you have to define the loop internal logic elsewhere because C++ has no lambda (yet, at least in most places where it's used in production).
Braindamage doesn't even begin to describe it.