1. 8
  1.  

  2. 3

    Might I suggest that if you’re doing metaprogramming with C++ you’re in the wrong language? C++ doesn’t have a clear underlying design for its internals that’s easy to reason about. In Ruby everything is an object, in Lisp everything is a pair (or even just a function).

    When I’m writing C/C++, I prefer stuff that’s straightforward, easy to understand, easy to profile, and most importantly easy to debug. Debugging C++ is hard enough as it is without templates/generics being thrown into the mix. If D dissuades metaprogramming, I think that’s probably a good thing.

    1. 6

      metaprogramming with C++ (or D)

      Nononono, metaprogramming in D is worlds apart from C++. I agree that template metaprogramming in C++ is horrible, mostly because it’s a bug in the language that was later elevated to the status of a feature. But in D metaprogramming is awesome. It almost feels like lisp macros. Any function that can be evaluated at compile time (i.e. which knows its inputs at compile-time) can be used to meta-program in D.

      1. 2

        Ooh, that’s actually pretty nice - I haven’t got any experience with D so I just assumed it was like a cleaner version of C++ with a similar macro system. I take it back then and redact it from my comment :)

      2. 4

        I think the point of the article is that doing simple metaprogramming in D is not fun and not challenging because D does have support for metaprogramming and simple things are straightforward enough.

        Far from everything in Lisp is a pair, by the way; and if you want to say that at least ASTs are really simple — well, in Julia you have many types of AST nodes but still doing nontrivial metaprogramming doesn’t feel too complicated. It can still be fun in languages with metaprogramming support, you just need to do something more complicated.

      3. 2

        [Metaprogramming in D has] a cleaner syntax and less intellectual effort required, stripping metaprogramming of all the fun you could have doing it in C++.

        If this is what “less fun” means, then sign me up.