News for hackers. Stuff that matters.
Re:C++ vs. Lisp by d0m on Tuesday May 04, 2010 @02:09PM (#1318839)
I have to agree that even thought STL is extremely powerful, it makes program extremely verbose.

But, in my opinion, the real reason C++ code seems so verbose is because of the lack of closures. In C++, when you need one, you have 2 choices: either manually coding everything that would be in the closure or create a totally new function.

In fact, in the new c++2k10, it could be interesting to have a STL-like but with closures instead.. so one can do: some_sequence.sort_by(_1 > _2);

or: foreach(sequence, cout << _1 << endl); that's, again in my opinion, way better than: for (int i = 0; i < sequence.size(); i++) { cout << sequence[i] << endl; } and again still better than: for (list<int>::size_type i = 0; i < sequence.size(); i++) { etc..}

Re:C++ vs. Lisp by wuch on Tuesday May 04, 2010 @03:44PM (#1319066)
Actually his example can be written quite succinctly (but in general case closures would be much more expressive):

copy(words.rbegin(), words.rend(), ostream_iterator<string>(cout));