Nigel Norfolk
June 22nd, 2006, 05:19 PM
In the introduction to the C++/CLI Langauge Specification it is stated that one of the goals used in the design of C++/CLI was to
"Provide first-class support for Standard C++ features ... for all types including CLI classes."
Unfortunately, there is a major ommision in C++/CLI, namely const correctness for managed classes. In particular, methods in these classes cannot be const (although parameters and return values can be). Experienced C++ programmers are careful to make methods const where appropriate as this provides a powerful compile-time check on program semantics.
Recent trends in C++ have stressed the importance of compile-time checks (for example, Andrei Alexandrescu's excellent book 'Modern C++ Design' and the associated library Loki.) Its a shame that C++/CLI takes a retrograde step in removing facilities for const correctness.
May I plea for const correctness to be introduced in a later version of C++/CLI.
Thank you
Nigel
"Provide first-class support for Standard C++ features ... for all types including CLI classes."
Unfortunately, there is a major ommision in C++/CLI, namely const correctness for managed classes. In particular, methods in these classes cannot be const (although parameters and return values can be). Experienced C++ programmers are careful to make methods const where appropriate as this provides a powerful compile-time check on program semantics.
Recent trends in C++ have stressed the importance of compile-time checks (for example, Andrei Alexandrescu's excellent book 'Modern C++ Design' and the associated library Loki.) Its a shame that C++/CLI takes a retrograde step in removing facilities for const correctness.
May I plea for const correctness to be introduced in a later version of C++/CLI.
Thank you
Nigel