Hacker News new | past | comments | ask | show | jobs | submit login

Exceptionally good critique. But there are exceptions: programming for Google's V8 in C++ is a pleasure. I've never seen any interpreter code so clean and easy to extend. Like a breath of fresh air.



No, it's not an "Exceptionally good critique." It's not exceptional, it's not good and it's not a critique.

It's not exceptional because nothing of the points he raises are anything but a re-re-rehash of the same old tiring arguments that have been raised against C++ for 15 years or more.

It's not good because the examples he makes are straight up wrong or so vague as to be useless. His 'const' example is jibberish and the line about adding two integers with templates doesn't make any sense whatsoever. I guess the response to this would be that these points were exaggerations, mere literary style figures, which is fine. But it does take away from the quality of it as a serious post.

And finally it's not a critique. A critique implies some level of sophistication, an honest attempt to understand something and providing well thought-out arguments against the trade offs that were made in the design, or different viewpoints on fundamental issues. This is just a rant, touching on some of the more superficial shortcomings of C++ that are easily worked around and that for the most part haven't hampered tens of thousands of C++ programmers to use the language successfully for 20 years. A rant, yes. Venting, OK. But a critique, this is not.


You're right. But I can only offer you an up-vote.


Embed V8 into Python, then tell me how great C++ is.

In other words, C++ is great until something else has to call it. Then you're hosed and end up wrapping everything in C anyway.


Hi Zed! Actually my code (unreleased but working prototype for a year) is an nginx server with a CMS module using V8 for scripting and templating web pages. Code is C (nginx module + w/ nginx-api) and C++/JS for the CMS. So I cross 3 languages. Works like a charm: ~6K req/s for complex queries (cached disk access with 1+ lstat() call every second.) Memory usage contained very well (always <20MB.) It's so good I don't touch the GC. Also since its security model for Chrome is among the best the "workers" can be recycled very fast if you create a good context.

The problem with V8, as with almost anything, is it doesn't support well threading and its GC can be a bit unpredictable like any other automagic memory management interpreter. But even so, there are ways to control it.

I certainly relate to what you wrote because I used to be a C++ dev in mid-90s (wintel, shivers.) But if you have some time, have a look at V8 for developers. It rocks. Also the newsgroup has a great community.


That's what I've written a library to fix - it makes it quick and easy to bind C++ api's to make them callable from a dynamic language. Not only can you bind a C++ function with 1 line of code, but if that function returns an object, the returned object's member functions are callable on its scripted instance:

http://github.com/dennisferron/LikeMagic

Currently there is only an Io backend, but the library is designed so that the same C++ bindings can be used with multiple different backend languages. It's like Boost::Python on steroids.


I've seen you talk about this on the Io list for a while now, but you never seemed to have posted a link to it. Glad I can finally take a look at it :)


http://www.swig.org/ automatically binds existing C++ software to other programming languages. I use it a lot to call C++ from Python and Java and I must say it is really amazing piece of software.

And there is also Boost.Python.


I don't know if V8 follows the Google C++ Style Guide[1] (I doubt it, but it is possible), but that could explain a lot. I feel that it provides a good balance between power and readability. You don't have the language-within-a-language pattern that arises in some of the boost libraries, but you do get RAII and a few template tricks. The language feels much like a cleaner Java, with very few opportunities to do something incredibly stupid.

However, if I had not been given the style guide and a more experienced reviewer to tell me right from wrong, I would be incredibly frustrated with the language. C++ is complex enough that a book probably isn't enough - you either need a mentor-type person or a very clean open source project to study.

[1]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: