|
|
|
|
|
by jlarocco
4032 days ago
|
|
This type of C++ code makes me sad. I can follow along and figure out what it's doing, but I really have to slow down and think about it. C++ template metaprogramming has the ugliest syntax of a "real" programming language that I've ever seen. Brainfuck might win for hardest to follow code, but god damn it, C++ is really trying. IMO, Lisp did metaprogramming the right way, 40 years ago. It's built into the language and doesn't look like a hacked on cluster f*. Anybody familiar with regular Lisp can follow along with Lisp metaprogramming, and it's far more powerful than what's available in C++. And nowadays, the performance is even competitive. |
|
I agree with your Lisp sentiment. It appears that the C++ folks have spent the last 15 (20?) years re-implementing Lisp macros badly. Every time they work out the kinks in the syntax, remove corner cases, and make it more expressive: it becomes more Lisp-like.
When you compare with the approach Ruby took (granted, Ruby is a dynamic language) you get the feeling that the C++ folks went wrong somewhere. Far be it from me who has never implemented a compiler to criticise them but that's the honest feeling I get. Ruby made everything an object with an associated class. Or what amounts to the same thing, it made every type of thing get-at-able as an object with an associated class. And here is the kicker, including Object and Class itself. Why could the C++ folks not have made type an object with an associated class with compile and runtime methods?
is just sugar for