220 1492 <cec3e240-fcd5-4f56-8e10-e9c5c9a4a75e@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: making using declaration more precise
Date: Mon, 7 Jan 2013 13:18:06 -0800 (PST)
Lines: 163
Approved: news@gmane.org
Message-ID: <cec3e240-fcd5-4f56-8e10-e9c5c9a4a75e@isocpp.org>
References: <738f626c-3b23-4c74-9eea-2c2246921a81@isocpp.org>
 <CAFk2RUZXzRmVckk+U4QnX1x20OCHDUL3LgcJ3g5yFDKyoKqzww@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_2014_5742179.1357593486946"
X-Trace: ger.gmane.org 1357593488 7138 80.91.229.3 (7 Jan 2013 21:18:08 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 7 Jan 2013 21:18:08 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBEPXVSDQKGQE4PYWKDQ@isocpp.org Mon Jan 07 22:18:26 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBBEPXVSDQKGQE4PYWKDQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qc0-f200.google.com ([209.85.216.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBEPXVSDQKGQE4PYWKDQ@isocpp.org>)
	id 1TsK5R-0003ho-CH
	for gclcip-std-proposals@m.gmane.org; Mon, 07 Jan 2013 22:18:25 +0100
Original-Received: by mail-qc0-f200.google.com with SMTP id l42sf30423872qco.11
        for <gclcip-std-proposals@m.gmane.org>; Mon, 07 Jan 2013 13:18:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:date:from:to:message-id
         :in-reply-to:references:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=yL5EB0qsU8k1Ooog/1dV+6T0+bInagA3Bk0Sr/F5XB8=;
        b=QdVC3RvPglC5WBKzyyj0IX40QwCA/9E4nzYCdn1lEYpvNWaKT3IN4vx1KgQt12437y
         +QhvG0e9fs2a5zqD4gkVO/rUf+uvjVu1QzcFLPaWVJEkOI1zd2iMSW0Z7SjL6uv+AZBa
         kZ+eh5btVOEJEKD7im1QPmTN006ZeqB0zqco66/hzEJrAtVs63rpMiXr4GCJtDCIm/8C
         8w+4BVWGzvXqfO0334PamRvOHKdNvbS71iauPQlsFNKLP2yb+qJGdjJbByz+/RjvVReQ
         I/tdTY30od3UcEEn6CcRBonQtQb7KOccbhJrqfOaPYmfHWe9GsA7h8vLEYUHhU1VP5gm
         rG+Q==
X-Received: by 10.224.190.193 with SMTP id dj1mr38290713qab.6.1357593489402;
        Mon, 07 Jan 2013 13:18:09 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.24.37 with SMTP id r5ls8885993qef.85.gmail; Mon, 07 Jan
 2013 13:18:08 -0800 (PST)
X-Received: by 10.49.39.99 with SMTP id o3mr10595144qek.14.1357593488223;
        Mon, 07 Jan 2013 13:18:08 -0800 (PST)
In-Reply-To: <CAFk2RUZXzRmVckk+U4QnX1x20OCHDUL3LgcJ3g5yFDKyoKqzww@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:1492
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/1492>

------=_Part_2014_5742179.1357593486946
Content-Type: text/plain; charset=ISO-8859-1



On Monday, January 7, 2013 11:08:05 AM UTC-8, Ville Voutilainen wrote:
>
> On 5 January 2013 20:07, Arthur Tchaikovsky <atch...@gmail.com<javascript:>> 
> wrote: 
> > I wonder if anyone feels the same as me about using declaration while 
> > specifying members from base class? As things are now, it is very blunt 
> and 
> > not very precise tool, which could be quite easily tweaked. 
> > What I mean is: 
> > class A 
> > { 
> > public: 
> > void f(); 
> > void f(int); 
> > }; 
> > class B: public A 
> > { 
> > using A::f;//here we cannot make a choice on which one we would like to 
> use 
> > in our B class, which sometimes is ok... 
> > }; 
> > but in scenario: 
> > class A 
> > { 
> > void f(int); 
> > public: 
> > void f(); 
> > }; 
> > class B :public A 
> > { 
> > using A::f;//will not compile even though the only fnc we want is A::f() 
> > }; 
> > What I would like to propose is following backwards compatible syntax: 
> > class B :public A 
> > { 
> > using A::f;//here I'm specifying that I want use every fnc 'f' from A - 
> just 
> > like before, but this will not compile 
> > using A::f();//here I explicitly specify which fnc I want to use 
> > }; 
> > The use case which is I believe compelling is the one that if function f 
> > overloaded and one or more is declared  private, this actively prohibits 
> us 
> > from the use of any other, non-private functions 'f' from the base 
> class. 
> > Looking forward to comments. 
>
> The work-around would, I think, be 
>
> class B :public A 
> { 
>    void f(int x) {A::f(x);} 
> }; 
>
> Adding the new syntax doesn't seem to be compelling compared to the 
> very low cost 
> of specifying exactly the signatures you want and calling the base 
> implementation of them. 
>

It's not as maintainable. If the syntax in `A` changes, you don't get a 
proper compiler error if the syntax happens to remain compatible with the 
old one. If they change `f(int)` to `f(int64_t)` or something, the compiler 
will silently let this work.

With the proposed syntax, if there is no `f(int)` in the base class, it 
fails to compile. Which forces everyone to update to the new syntax. It's 
also a lot more obvious what's going on.

-- 




------=_Part_2014_5742179.1357593486946
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Monday, January 7, 2013 11:08:05 AM UTC-8, Ville Voutilainen wro=
te:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;">On 5 January 2013 20:07, Ar=
thur Tchaikovsky &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscat=
ed-mailto=3D"OcIk-eH-UNwJ">atch...@gmail.com</a>&gt; wrote:
<br>&gt; I wonder if anyone feels the same as me about using declaration wh=
ile
<br>&gt; specifying members from base class? As things are now, it is very =
blunt and
<br>&gt; not very precise tool, which could be quite easily tweaked.
<br>&gt; What I mean is:
<br>&gt; class A
<br>&gt; {
<br>&gt; public:
<br>&gt; void f();
<br>&gt; void f(int);
<br>&gt; };
<br>&gt; class B: public A
<br>&gt; {
<br>&gt; using A::f;//here we cannot make a choice on which one we would li=
ke to use
<br>&gt; in our B class, which sometimes is ok...
<br>&gt; };
<br>&gt; but in scenario:
<br>&gt; class A
<br>&gt; {
<br>&gt; void f(int);
<br>&gt; public:
<br>&gt; void f();
<br>&gt; };
<br>&gt; class B :public A
<br>&gt; {
<br>&gt; using A::f;//will not compile even though the only fnc we want is =
A::f()
<br>&gt; };
<br>&gt; What I would like to propose is following backwards compatible syn=
tax:
<br>&gt; class B :public A
<br>&gt; {
<br>&gt; using A::f;//here I'm specifying that I want use every fnc 'f' fro=
m A - just
<br>&gt; like before, but this will not compile
<br>&gt; using A::f();//here I explicitly specify which fnc I want to use
<br>&gt; };
<br>&gt; The use case which is I believe compelling is the one that if func=
tion f
<br>&gt; overloaded and one or more is declared &nbsp;private, this activel=
y prohibits us
<br>&gt; from the use of any other, non-private functions 'f' from the base=
 class.
<br>&gt; Looking forward to comments.
<br>
<br>The work-around would, I think, be
<br>
<br>class B :public A
<br>{
<br>&nbsp; &nbsp;void f(int x) {A::f(x);}
<br>};
<br>
<br>Adding the new syntax doesn't seem to be compelling compared to the
<br>very low cost
<br>of specifying exactly the signatures you want and calling the base
<br>implementation of them.
<br></blockquote><div><br>It's not as maintainable. If the syntax in `A` ch=
anges, you don't get a proper compiler error if the syntax happens to remai=
n compatible with the old one. If they change `f(int)` to `f(int64_t)` or s=
omething, the compiler will silently let this work.<br><br>With the propose=
d syntax, if there is no `f(int)` in the base class, it fails to compile. W=
hich forces everyone to update to the new syntax. It's also a lot more obvi=
ous what's going on.<br></div>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_2014_5742179.1357593486946--

.
