Why do C++ programmers are not interested in D?
Gregor Mückl
gregormueckl at gmx.de
Wed Nov 27 15:47:53 UTC 2019
On Saturday, 23 November 2019 at 19:35:55 UTC, Mark wrote:
> 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.
C# and Java have extremely powerful runtime reflection and code
generation capabilities. It may not be well known, but there are
frameworks out there that look at classes in other libraries at
runtime and dynamically generate new bytecode to wrap those for
various purposes. Some versions of JBoss did this to inject
authorization checks in EJBs: they'd create a new anonymous
implementation of the EJB's interface that wraps every function
with such a test that forwards to the actual EJB implementation.
In most cases, however, you get away without explicit code
generation. You can quite easily call unknown methods through
reflection or query and change the values of variables. All of
this can also ignore all access specifiers as it bypasses the
compiler.
These features are really, really powerful cannons. Also, nothing
prevents you from aiming them at your own feet. It's a good thing
that they are generally used very sparingly (except when they
aren't).
More information about the Digitalmars-d
mailing list