Why do C++ programmers are not interested in D?
smarksc at gmail.com
Sat Nov 23 19:35:55 UTC 2019
On Tuesday, 19 November 2019 at 14:36:06 UTC, Ola Fosheim Grøstad
> I think library authors do, though. Anyway there are issues
> related to meta programming in C++, D, and Rust. But they all
> also improve on that for every significant version bump.
> Whoever stops evolving their metaprogramming features will fall
> Rust is getting const generics eventually and C++ has added
> many library features and some minor language tweaks. It would
> be a good idea for D to make some statements about what is
> coming on the metaprogramming front.
Yes, I think some support for generic programming is generally
expected from any modern programming language. This greatly
benefits library authors and, in turn, library users. I'm not
surprised that Go is also pursuing generics now.
But in my view it's not clear how far languages should take their
MP (metaprogramming) support. D has more MP support than any
other statically-typed language that I know of, but even D hasn't
taken it to the extreme:
- It doesn't have AST macros and, as far as I know, there are no
plans to ever include them in the language.
- Compile-time function evaluation is subject to various
restrictions: for instance, you can't make arbitrary system
calls. I'm not up to speed on the current limitations of the CTFE
engine, but I believe W&A want compilation to be deterministic,
and this naturally restricts the operations allowed at
compile-time. (Someone please correct me if I'm wrong)
This brings to mind the adage "absolute power corrupts
I can perfectly imagine a C# programmer (even library author)
saying "I love generics, extension methods and lambda
expressions, but that's good enough for me. I can live without
`static if` and a full CTFE engine". That said, it's not like
I've done a survey among the C#, Java, C++, Go, Rust, or Swift
crowd. Maybe most programmers (or at least library authors) in
these languages *do* wish for D-level MP support in their
language. But that's a question that needs to be investigated;
the answer is not obvious at all IMO.
More information about the Digitalmars-d