220 32802 <05407ce7-891e-4355-a5de-d58a7f8f947e@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: virtual class
Date: Tue, 20 Jun 2017 08:54:07 -0700 (PDT)
Lines: 88
Approved: news@gmane.org
Message-ID: <05407ce7-891e-4355-a5de-d58a7f8f947e@isocpp.org>
References: <24b0f800-5cea-47fe-b0ac-13333003b959@isocpp.org>
 <CAGNvRgB8aJU=x42whgOc0guic-UKWWf9=h=xic31cT8R1Eg5hQ@mail.gmail.com> <CAPCFJdR8TgkE6J=aKh1mTsgmDgA-P0rxXAwOXP_C71uQ3hvw+w@mail.gmail.com>
 <CA+fGSbNXzZ9vkXEKyoOUYrocimVz3FyT8FfVL9J5HLXAE2zqVw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2133_1985377505.1497974047951"
X-Trace: blaine.gmane.org 1497974054 24094 195.159.176.226 (20 Jun 2017 15:54:14 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 20 Jun 2017 15:54:14 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBIEKUXFAKGQEDWSDCPQ@isocpp.org Tue Jun 20 17:54:08 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBIEKUXFAKGQEDWSDCPQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f198.google.com ([209.85.192.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBIEKUXFAKGQEDWSDCPQ@isocpp.org>)
	id 1dNLTj-0005iW-4X
	for gclcip-std-proposals@m.gmane.org; Tue, 20 Jun 2017 17:54:08 +0200
Original-Received: by mail-pf0-f198.google.com with SMTP id a82sf132982572pfc.8
        for <gclcip-std-proposals@m.gmane.org>; Tue, 20 Jun 2017 08:54:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=wpioKUWrnIGaxyOrHtlCqqFtMOzMiUE+ilY2F0V3R/w=;
        b=ZVFsKAA0bES5r+H9hbPG2/EuhpmP+wKrMP0dcQJzCHTSmIb5wnUQ5Nap4qu/r/8+1S
         n9KZmKyIozITmnCMZD7Lky39TIkeO1PBbfBkAspBqfKKYI2zd/t7QeuzN924id3B4AHG
         h/xoYheBjUDAVSVFtYsMy858oQzfY484dV8NJRUyxjNqhmm/7R/PGO7jcFEajXdeehmv
         IiFZ2PxKlRQT8/v5agvGBIPH1XG1GA21mUShKeW/Frz5UnCHRtQqAOpcoUmX8EkMrvfg
         FXonRql59W6TPoCnWfNUMz7xvVFFw9QXy801Y9a2NfBis52n5dD86FoJ5s2SrUQSsDXb
         lYSw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=wpioKUWrnIGaxyOrHtlCqqFtMOzMiUE+ilY2F0V3R/w=;
        b=l4vlcSBFh6U80zOPhy25W7zzPhevJyCGNbL5BbGQkApLJpVSgD4Nie7bVxXNYaSzVF
         kXxcixt0MUgzasJlSE2eeouKinGw9AcChgNnDFAd5jTSlIkRem1X4Ydefti2R6BRdwUI
         6oLFgSk61s/5xT4Y6SGmKFxUAPvAF5pMp9qIEKInCRzVQe+bTX+x5cJ1dbZVAwCvu5NB
         EUuOerRC/7zR+p8JM7UlfQnkI0Xde5ZrKezMrKSuqvprzuY7v0q07svk581yonmTzTv9
         jpDg4gvN2sZ+vtUhGUMCYrVKuZ548ShAbH+2zSIpWbNrQg5UBBR6kOKMF3yaF9N+pFc8
         djUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=wpioKUWrnIGaxyOrHtlCqqFtMOzMiUE+ilY2F0V3R/w=;
        b=BALwliA5ReLMzGCjhoCaKuqvEwti+YNzvmmRbXINWnsNajYRw+kxMqxu7Y4Aor8zd5
         R+jTNboNF8+SLmqUM82Bb5RUOa9719p77SiiOfhH388WGjROn76ZetR9NuC3VymbOHCg
         VEbTYLu9aqLcuA22snLV0bPlb/nALRoykji8jadI/+2UBXHkQHl7v5unFUE1ha7/cAJx
         nd+JplssPOO7Wug2CXeVx5gW1hwgdUDHjvxd4j3TE4TXMeBxTXE3EOdHVrDMoG9YwoLi
         KEPlPBguKfuuTAuLkjlY/Y9+gEvIM0VlPeRFssjn9SnWb729nsgTqW1nW8WNSb7R6h+v
         YrSA==
X-Gm-Message-State: AKS2vOzdE6uj4fbi1W7MhxmsF3OX8GwIDniefjdMApuYYZnkEzmifGeT
	IOrIG/YIqtwLHIFu
X-Received: by 10.101.88.203 with SMTP id e11mr16606975pgu.126.1497974049563;
        Tue, 20 Jun 2017 08:54:09 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.47.194 with SMTP id b2ls1914606otd.5.gmail; Tue, 20 Jun
 2017 08:54:08 -0700 (PDT)
X-Received: by 10.157.47.207 with SMTP id b15mr929786otd.20.1497974048557;
        Tue, 20 Jun 2017 08:54:08 -0700 (PDT)
In-Reply-To: <CA+fGSbNXzZ9vkXEKyoOUYrocimVz3FyT8FfVL9J5HLXAE2zqVw@mail.gmail.com>
X-Original-Sender: jmckesson@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:32802
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32802>

------=_Part_2133_1985377505.1497974047951
Content-Type: multipart/alternative; 
	boundary="----=_Part_2134_210507740.1497974047951"

------=_Part_2134_210507740.1497974047951
Content-Type: text/plain; charset="UTF-8"

On Tuesday, June 20, 2017 at 11:36:57 AM UTC-4, Ricardo Andrade wrote:
>
> What to say about final and override then?
> Do they lead to more use of bad dynamic polymorphism or just make it less 
> error prone?
> Any idea that prevents mistakes should be welcome.
>

`override` merely prevents mistakes. The cases where `override` would cause 
a compile error are cases where the user's declared intent does not match 
the function signature they have written. You intend to override a 
function, but there is no matching signature to be override. That's clearly 
a mistake.

This notion of `virtual` "prevents mistakes" only if you start from the 
belief that all non-virtual inheritance is a mistake. But this belief is 
decidedly nonsensical.

Please provide a demonstration of a class that *must* be virtually 
inherited in all places where it gets used as a base class. Where *all* 
non-virtual inheritance of such a class would be as clear a mistake as 
those caught by `override`.

You could suggest a "lighter" version of this `virtual class` notion, where 
you only get a compile error if there are multiple, non-virtual 
inheritances of the same base class. However, I would again like to see a 
base class where, by the nature of that base class, this would *always* be 
a problem.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/05407ce7-891e-4355-a5de-d58a7f8f947e%40isocpp.org.

------=_Part_2134_210507740.1497974047951
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, June 20, 2017 at 11:36:57 AM UTC-4, Ricardo An=
drade wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">W=
hat to say about final and override then?<div>Do they lead to more use of b=
ad dynamic polymorphism or just make it less error prone?</div><div>Any ide=
a that prevents mistakes should be welcome.<br></div></div></blockquote><di=
v><br>`override` merely prevents mistakes. The cases where `override` would=
 cause a compile error are cases where the user&#39;s declared intent does =
not match the function signature they have written. You intend to override =
a function, but there is no matching signature to be override. That&#39;s c=
learly a mistake.<br><br>This notion of `virtual` &quot;prevents mistakes&q=
uot; only if you start from the belief that all non-virtual inheritance is =
a mistake. But this belief is decidedly nonsensical.<br><br>Please provide =
a demonstration of a class that <i>must</i> be virtually inherited in all p=
laces where it gets used as a base class. Where <i>all</i> non-virtual inhe=
ritance of such a class would be as clear a mistake as those caught by `ove=
rride`.<br><br>You could suggest a &quot;lighter&quot; version of this `vir=
tual class` notion, where you only get a compile error if there are multipl=
e, non-virtual inheritances of the same base class. However, I would again =
like to see a base class where, by the nature of that base class, this woul=
d <i>always</i> be a problem.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/05407ce7-891e-4355-a5de-d58a7f8f947e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/05407ce7-891e-4355-a5de-d58a7f8f947e=
%40isocpp.org</a>.<br />

------=_Part_2134_210507740.1497974047951--

------=_Part_2133_1985377505.1497974047951--

.
