This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: New C++ Attribute: final
- From: Chris Lattner <sabre at nondot dot org>
- To: Joe Buck <Joe dot Buck at synopsys dot COM>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>,Nathan Sidwell <nathan at codesourcery dot com>,Kevin Atkinson <kevina at gnu dot org>, Mark Mielke <mark at mark dot mielke dot cc>,<gcc at gcc dot gnu dot org>
- Date: Mon, 1 Mar 2004 13:36:02 -0600 (CST)
- Subject: Re: RFC: New C++ Attribute: final
> Every problem in computer science can be solved by an extra level of
> indirection. Or rather, every problem other than inadequate
> performance. Such claims usually come from those who follow rigid
> ideological approaches to object-oriented design.
Speaking from the perspective of a developer that writes a lot of C++
code, I totally agree with your viewpoint. There _are_ workarounds that
don't cause code duplication (in the derived class, have a non-virtual
method do the work, and have the virtual one just call it), but these are
really gross and seemingly against the spirit of C++.
Also, it's not feasible to make all of the clients know about this
distinction, and if it changes over time, it's not scalable to modify tons
of client code where we could just modify one declaration in the header.
Also, if the client code is really a template using std::mem_fun or
something, it's not *possible* to change the client (without even more
gross hacks I suppose).
In my situation, I have complete control over the class hierarchy and if a
new subclass needs to be added, it's ok to remove the attribute and force
clients to recompile. Though not everyone is in this situation, many are,
and it seems very reasonable to support it directly: even as a GCC
extension.
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/