Re: C++0x - why so restrictive with new keywords ?
On May 28, 5:13 am, akfmn...@t-online.de (Andre Kaufmann) wrote:
the C++ committee is very restrictive in introducing new keywords in the
C++ standard.
Because the might break existing code.
An example is the proposal for overriding virtual
functions. (Sad story is I don't know yet if it will be really in the
final draft).
It shall have the syntax:
virtual void foo() >= 0;
virtual void foo() > 0;
Where the natural "human" readable version would be IMHO:
virtual void foo() override abstract;
virtual void foo() override;
Would the introduction of new keywords really break that much
"old" code ? I don't think so, if the keywords would be
interpreted only in the context of a function declaration so
that old code:
Context dependent keywords is a slippery slope, that I don't
think anyone really wants to go down. They make understanding
the language considerably more difficult.
On the other hand, I'm not really sure that adding "override" as
a keyword would break that many programs (I'm less sure about
abstract). More importantly, if the keyword is only legal in
this context, any that it breaks would break at compile time.
In this case, I'd go with the keyword, despite breakage.
[...]
Additionally it's commonly preferred to implement new functionality in
code, rather than introducing new keywords.
You mean in the library, rather than in the language. There are
a number of advantages to introducing new features in the
library, when it works.
I just would it prefer the other way round, because commonly the
compiler can be more effective and handling is commonly easier by using
a new keyword than a big template library.
E.g.: member function pointers.
I don't follow you here. Pointers to member functions aren't a
new concept, and they're part of the language.
It's impressive how much can be done in plain "old" C++98, but
nevertheless I think the compiler could handle member function pointers
more effective than a library.
Only the language can handle them. That's why they're part of
the language.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]