P
Pascal J. Bourguignon
James Kanze said:James Kanze said:(e-mail address removed) wrote:
[...]
One place C++ falls down badly is for run-time
metaprogramming. I have yet to find a good solution for
this. Java seems to offer the most popular compromise
between static typing and run-time introspection
("reflection"), if not outright metaprogramming. Lisp and
Smalltalk both seem to have better support, but lack
popularity in industry, possibly because they lack static
typing.
Exactly. It's a question of reliability: the more errors
that can be caught by the compiler, the less escape into the
actual program. I work mainly on systems where high
reliability is important. For those, even Java is too
"dynamic", and C++ (or Ada 95) seem to be about right. Note
that the size of the application is an issue as well. The
more people collaborating on the coding, the more static
checking becomes important as well.I think there's a conceptual error in thinking that the
compiler will help catch the errors that matter.
All errors matter. And an error caught by the compiler costs
significantly less to correct than one caught by unit tests, or
even one caught by code review.
Well of course. But I meant to dismiss errors that are signaled by a
compiler that would not be errors with a more dynamic language.