73 points · by StylifyYourBlog · 11y ago · 48 comments
The Zend Engine 3 (aka the stock PHP 7 interpreter) is, according to one HHVM developer, 'embarassingly competitive on the test suites', and it's written in C.
/rant
C++ is probably much nicer to maintain, though. C ends up being macro hell.
If it is, I wonder how they feel now that they have given up speed improvements and built a VM in search of other advantages. At least if they had chosen the JVM they could have taken advantage of interoperability that JVM provides with other languages to convert at least part of their code base to JVM languages, thereby possibly improving maintainability.
I used to loathe C++, but the C++11/14 dialect makes things much more pleasant. There's still a lot of details you need to worry about, but crucially these are details that other languages rarely give you a choice about. The only real alternative was C, but I'm tired of reinventing wheels and C++ has the STL. C also doesn't have the same support for value types which C++ does, and value types are really nice to use.
struct IntForFoo { int value; };
when you use it you write a function that takes an IntForFoo as one of its arguments and you get type safety over other ints. Gently snarl at anyone who does a .value outside such a function. Include a constructor function, an assignment function... Remember that that typedefs just lie to you about the type, they don't change it for type checking...
If you need to generate code, do it, macros and templates are just really crappy ways of generating code; you can do a lot better when you need to. But how often do you really need to and how often are you worshipping at the false idol of "must be general so can be used for 100 years" when that's really not the purpose of the code?
Polymorphism and templates are overrated by C++ designers you don't actually need them and they encourage some awful designs.
As for the generated code bit, I assume you're referring to the STL. Writing my own data structures is explicitly what I don't want to do anymore. STL has it? Great, I use it and move on.
C++ could really use a "C++: The Good Parts" book.
http://www.amazon.com/Tour-In-Depth-Series-Bjarne-Stroustrup...
What it could really use some deprecation of the more idiotic, dangerous, useless features (eg explicit constructors should be the default, unbraced single line blocks only introduce bugs and have no positive value at all). They should also mandate that standards conforming STL implementations ship with a standard set of benchmarks you can run on the hardware you're targeting. All the C++ "anointed smart people" complain people use the wrong STL datastructures but don't show any cleverness at all in solving that problem.
No 2 C++ hackers agree on what constitutes "The Good Parts" witness every single C++ style guide ever endorsing a different subset of the language. C++11/14 has not changed this. Modulo different targets make that subset different from the point of view of the very same hacker.
When faced with the sad fact that Turbo Pascal was PC only I had to choose another language.
The year was 1993 and C already looked dated when compared with what Turbo Pascal was capable of. Also when compared against Modula-2, which was on the way out as well.
So I went C++, which even with C++ ARM compatibility issues, was way safer than C.
Nowadays there are plenty of compiled languages to choose from, but between C++ and C I only pick C if obliged to do so.
I get the premise, but at least with braces there's no ambiguity at all about where a statement begins and ends. It's certainly not going to be the case that one tab too many or a space instead of a tab wrecks everything. Explicit is supposed to be better than implicit, right? I can't think of anything more implicit than using whitespace as syntax.
My personal bias is that whitespace is meant to make code human readable. It shouldn't matter to the interpreter, or at least, it shouldn't be critical to the degree that it seems to be for Python.
Of course I say this knowing perfectly well that Pythonists look at C code with its braces and think it's redundant and noisy.