Live data from Hacker News

C++11 and Boost - Succinct like Python

fendrich.se

1–10 of 172 posts

Re: C++11 and Boost - Succinct like Python

#2
Great post, it's always fun to see the cutting edge of C++ revealed. It's such a strange land. :)

To me, this post would have been 10X more interesting if there was some elementary benchmarking included. If it's about the same speed as the corresponding Python code, which I'd bet is easier to write for more programmers, then I don't quite see the point being as clearly proven.

If it's 100 times faster (or whatever), then it gives more credibility to the idea of writing code like this in C++ to begin with, and to learning all the new language features that makes it safe while being that much faster than Python.

Re: C++11 and Boost - Succinct like Python

#3
"you will notice that it is more or less as succinct as the Python code." ??? I hope that this person writes better python than this:

    const map> TagDataMap {
      {"title" , make_tuple( 3, 30, stripnulls)},
      {"artist" , make_tuple( 33, 30, stripnulls)},
      ...
it will be succinct when the whole type can get reduced to "auto". Python would just do:

    TagDataMap = {
        'title': (3, 30, stripnulls),
        'artist': (33, 30, stripnulls),
        ...
Ord implementation is also crazy:

    int i = static_cast(s[0]);
    return (boost::format("%1%") % i).str(); 
considering it doesn't even handle different string encodings.

I don't want to complain about C++. It's a great language and has its uses. But it's not succinct and it's far away from what scripting languages provide. Claiming otherwise is close to fanboyism. Not being succinct is not a bad thing. There are many other things that C++ does for you that Python doesn't.

Re: C++11 and Boost - Succinct like Python

#4
post #2

Great post, it's always fun to see the cutting edge of C++ revealed. It's such a strange land. :) To me, this post would have been 10X more interesting if there was some elementary benchmarking included. If it's about the same speed as the corresponding Python code, which I'd bet is easier to write for more programmers, then I don't quite see the point being as clearly proven. If it's 100 times faster (or whatever),…

The simplifications are nice, but the problem is that the language still carries all of the heavy syntactic machinery that makes it happen, and there's nothing that prevents people from dipping down into it.

Re: C++11 and Boost - Succinct like Python

#5
post #2

Great post, it's always fun to see the cutting edge of C++ revealed. It's such a strange land. :) To me, this post would have been 10X more interesting if there was some elementary benchmarking included. If it's about the same speed as the corresponding Python code, which I'd bet is easier to write for more programmers, then I don't quite see the point being as clearly proven. If it's 100 times faster (or whatever),…

Especially if the benchmark measured programming and debugging time.

Re: C++11 and Boost - Succinct like Python

#6
post #3

"you will notice that it is more or less as succinct as the Python code." ??? I hope that this person writes better python than this: const map > TagDataMap { {"title" , make_tuple( 3, 30, stripnulls)}, {"artist" , make_tuple( 33, 30, stripnulls)}, ... it will be succinct when the whole type can get reduced to "auto". Python would just do: TagDataMap = { 'title': (3, 30, stripnulls), 'artist': (33, 30, stripnulls), .…

You misunderstand the purpose of ord. The mp3 metadata uses one byte to encode an integer between 0 and 255, which represents genre. It is not a string.

Re: C++11 and Boost - Succinct like Python

#8
post #2

Great post, it's always fun to see the cutting edge of C++ revealed. It's such a strange land. :) To me, this post would have been 10X more interesting if there was some elementary benchmarking included. If it's about the same speed as the corresponding Python code, which I'd bet is easier to write for more programmers, then I don't quite see the point being as clearly proven. If it's 100 times faster (or whatever),…

I wrote this post.

The program is I/O-bound, so the only speed improvement comes from not having to start up the Python interpreter.

If the task was CPU bound, you would get a great performance boost (sometimes 100x over CPython), but that is well known.

There can be other reasons than performance for writing in C++. Used well, the strong static type system can catch many bugs. I suspect (but I cannot prove) that it could be almost as good as Haskell.

I use Python for most things, though, so I don't really advocating switching to C++ for every little scripting task.

Re: C++11 and Boost - Succinct like Python

#10
The only point that finds me in disagreement is the need for a code standard that decides well on which parts should be used and how. I don't understand: why limiting ourselves? Why choosing such a well-tested instrument and choosing NOT to use some of it?
Post reply on HN