220 26785 <4b8b5bd1-d8e2-4f70-bb83-96cc3dd519a9@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: ezmagician@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: `pure` virt-specifier-seq to denote pure virtual functions.
Date: Mon, 11 Jul 2016 14:31:59 -0700 (PDT)
Lines: 195
Approved: news@gmane.org
Message-ID: <4b8b5bd1-d8e2-4f70-bb83-96cc3dd519a9@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_501_1155364340.1468272719348"
X-Trace: ger.gmane.org 1468272723 1404 80.91.229.3 (11 Jul 2016 21:32:03 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 11 Jul 2016 21:32:03 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD6OBG4L6YJRBUFASC6AKGQEAKAKELA@isocpp.org Mon Jul 11 23:32:03 2016
Return-path: <std-proposals+bncBD6OBG4L6YJRBUFASC6AKGQEAKAKELA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f70.google.com ([209.85.220.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD6OBG4L6YJRBUFASC6AKGQEAKAKELA@isocpp.org>)
	id 1bMio6-0003WW-Dc
	for gclcip-std-proposals@m.gmane.org; Mon, 11 Jul 2016 23:32:02 +0200
Original-Received: by mail-pa0-f70.google.com with SMTP id q2sf80398876pap.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 11 Jul 2016 14:32:01 -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: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=UFwI7oRaHcd7AwEHn1Oa8eLupRSHROEm8Yl8thsClO4=;
        b=se4RAM9mPOJlbKDXMFBjT4Nj7J9yMb2/edDeRO3c4j8YA6HqpGxXRZHiNveTVcAPPM
         7P70BZlwzNaeFL1uRSI8akRuuwkt0lPN3o9hzOVab0lpWLgIdgFzk7NCS/IhtKiuriKr
         bW0zdKn5fnuRjk74XGugXle9e6a6tlNzRSjbYIcgQp8Q0BRhs89LaPvoGG0B1fZtI55A
         uNEkprArWIMnBFXaQbaEIQbqas7YyKpul/72PsjfzjHNlSZwL9crtQEUKKZTkTMeCEC/
         mhuOVgcMQ2KHYGrwJA4d7aL6gnNJas9KMw7Bmc8X2Vq4adKNsdX4KtAXLS+w/GoC/Tys
         v4Ww==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id: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=UFwI7oRaHcd7AwEHn1Oa8eLupRSHROEm8Yl8thsClO4=;
        b=DQawAsQbeJ/9ZgfDbx0RGOxxZh8NF7xd0kWTCQ5xxuBXp9jIvRjuJwRSjumENl+NTP
         cg65YNoeKIed9rtWlXIw2tDWrRaCtspQM6Adh6fGqGUcn5ZSjaZVY6Y5rXLNGIWXoWdW
         Jx01v2qrW0ENYmPLY94gjjfvb0WWG7NgE3Yf7TVGhmPNOttt/n5abE0cZ3HaAvrRjoi0
         mmRl9w1WIE54EwPB8TJ5DOnYDv6MLLcXg1Z18d9neeOABQslm8gE9i1pVbMG4Zsf2TzR
         wBdCrXj93CBfmB6jfyf4P9oCaAOFwcE41ShJWISWk2RDFN9reAo8yAaQ24oqK2W5JTzB
         XHZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id: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=UFwI7oRaHcd7AwEHn1Oa8eLupRSHROEm8Yl8thsClO4=;
        b=MI6K5wkaHADJYXpeobBlFvKULWVjH7FiBFP9nkiVk4J5d0xaaiweKc4z6H828sOIOP
         p/oSMSD0cFkaqynYIuLVqZ16GkrplAxBC0EOESlnhw7SP8mvHWO7oWZy+3KkiR72EnMl
         s7rFG/vmHOqLcjnE6J4IxFnXWsX0d8lkNYZ27vaHL8kXE8vYK4rGejxp/mIWdlFFuD8h
         9aCs9C6TcbMuOKL3YhwinRsLdr/kRc+Ehdt3PkByyH5ONoYtliqa74q8T75pjpJDYsA2
         zZVFd4tqr9yDEbcMga9nGB0/JAng9TLCGnVg/mEfc7obMWr59R4ySyuzIz78hcujWXub
         5gKQ==
X-Gm-Message-State: ALyK8tKCRlHZkj14HDX3Jk3B6dv4UoKeO9fuC/8vFqydhGYBT1mHibB7PlpeSVqWuTwwgg==
X-Received: by 10.98.82.12 with SMTP id g12mr19253868pfb.14.1468272721239;
        Mon, 11 Jul 2016 14:32:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.168.168 with SMTP id e40ls1704408ioj.50.gmail; Mon, 11 Jul
 2016 14:32:00 -0700 (PDT)
X-Received: by 10.36.50.75 with SMTP id j72mr352190ita.5.1468272720304;
        Mon, 11 Jul 2016 14:32:00 -0700 (PDT)
X-Original-Sender: ezmagician@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:26785
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26785>

------=_Part_501_1155364340.1468272719348
Content-Type: multipart/alternative; 
	boundary="----=_Part_502_599407637.1468272719349"

------=_Part_502_599407637.1468272719349
Content-Type: text/plain; charset=UTF-8

What are your thoughts on adding a new virt-specifier-seq specifying that a 
function is pure virtual?

It would follow the same rules as the `override` and `final` specifiers.
This syntax would also allow a clear, simple syntax for in-class 
definitions.

struct A {
//  In class pure virtual function definitions.
//  Follows same syntax as override and final specifiers, which are also
//  used to describe/enforce properties of virtual functions.
    virtual void foo() pure;
    virtual void bar() pure;

//  Allows for function definitions in the class declaration using the same
//  syntax as the override and final specifiers without the strange look of
//  previously suggested syntax of the form: void func() = 0 { }.
    virtual void ~A() pure = default;

//  Current syntax for denoting a pure function is strange.
//  This syntax is not used anywhere else in C++ (to my knowledge).
//  virtual void ~A() = 0;

//  Compiler error message seems to imply that a pure virtual function
//  cannot have a definition: "error: pure-specifier on function-definition"
//  virtual void bar() = 0 { };
};

// The current way to define a pure virtual function by overloading the 
function
// outside the class declaration is non-intuitive. 
// Danger of multiple definition errors if not inlined in a header.
// inline void A::A~() = default;

struct B : A {
    void foo() override final { }

//  pure specifier does not conflict with other virtual specifiers, although
//  the use of a pure-final function may be questionable.
    void bar() override pure;
};


-- 
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/4b8b5bd1-d8e2-4f70-bb83-96cc3dd519a9%40isocpp.org.

------=_Part_502_599407637.1468272719349
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>What are your thoughts on adding a new virt-specifier=
-seq specifying that a function is pure virtual?<br></div><div><br></div><d=
iv>It would follow the same rules as the `override` and `final` specifiers.=
</div><div>This syntax would also allow a clear, simple syntax for in-class=
 definitions.</div><div><br></div><div><div class=3D"prettyprint" style=3D"=
border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-col=
or: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> A </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">// =C2=A0In class pure virtual fun=
ction definitions.</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">// =C2=A0Follows same syntax as override and final specifiers, which are =
also</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =C2=A0use=
d to describe/enforce properties of virtual functions.</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">virtual</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> foo</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> pure</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">virtual</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> bar=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> pure</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">// =C2=A0Allows for function defin=
itions in the class declaration using the same</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">// =C2=A0syntax as the override and final spe=
cifiers without the strange look of</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" class=3D"s=
tyled-by-prettify">// =C2=A0previously suggested syntax of the form: void f=
unc() =3D 0 { }.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">virtual</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">~</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> pure </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">default</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">// =C2=A0Current syntax for denoting a pure function is strange.</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// =C2=A0This syntax is n=
ot used anywhere else in C++ (to my knowledge).</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;=
" class=3D"styled-by-prettify">// =C2=A0virtual void ~A() =3D 0;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">// =C2=A0Compiler error=
 message seems to imply that a pure virtual function</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#800;" class=3D"styled-by-prettify">// =C2=A0cannot have a definition: &quo=
t;error: pure-specifier on function-definition&quot;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#800;" class=3D"styled-by-prettify">// =C2=A0virtual void bar() =3D 0 { };<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// The current way to defin=
e a pure virtual function by overloading the function</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
 #800;" class=3D"styled-by-prettify">// outside the class declaration is no=
n-intuitive. </span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =
Danger of multiple definition errors if not inlined in a header.</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// inline void A::A~() =3D =
default;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">stru=
ct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> B </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> A </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> foo</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">override</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">final</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: =
#800;" class=3D"styled-by-prettify">// =C2=A0pure specifier does not confli=
ct with other virtual specifiers, although</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" cla=
ss=3D"styled-by-prettify">// =C2=A0the use of a pure-final function may be =
questionable.</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> bar</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">override</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> pure</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span></div></code></div><br><br></di=
v></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/4b8b5bd1-d8e2-4f70-bb83-96cc3dd519a9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4b8b5bd1-d8e2-4f70-bb83-96cc3dd519a9=
%40isocpp.org</a>.<br />

------=_Part_502_599407637.1468272719349--

------=_Part_501_1155364340.1468272719348--

.
