C++ Logo


Advanced search

Re: Conditional final class-virt-specifier

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sat, 11 Jul 2020 19:26:30 +0300
On Sat, 11 Jul 2020 at 19:09, Arthur O'Dwyer via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Besides the other (all correct) responses you've received,
> > Conditioning inheritance was widely requested for many years,
> {{citation needed}}

If you want to limit what classes can use a class as a base, make
everything (esp. constructors) in the class private,
make the "welcome" classes friends and ensure that they behave. That's
what some of us have indeed
been doing for many years in order to limit the set of classes that
can inherit from a particular base,
and suggestions for some more direct facility haven't come up, because
that was unnecessary.

Furthermore: the proposal states "Disadvantages: none", "Design
trade-offs: none". While the latter may
end up being somewhat accurate, the first one is complete nonsense,
rendering this proposal technically
ill-formed. To look at the pros and cons of a proposal, the proposal
should look at other ways to achieve
the same solution, and explain why the chosen approach is purportedly
the right one. And for *any*
extension to the language, the benefit/cost has to factor in increased
language complexity, which is
a specification/implementation/deployment/education cost, and that
cost is never zero. So the
basic question "why is this worth having?" is not answered by the proposal.

Received on 2020-07-11 11:29:57