220 19899 <2cd343b5-b450-47c3-8ab9-806819768843@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: default arguments
Date: Tue, 18 Aug 2015 10:23:31 -0700 (PDT)
Lines: 110
Approved: news@gmane.org
Message-ID: <2cd343b5-b450-47c3-8ab9-806819768843@isocpp.org>
References: <ef9c7cbe-e8f1-4196-83bc-11a1c9b2798c@isocpp.org>	<CANu6V4UOxgZ9GV9f8DTbtW6BXrBPA7_2yUDRyhXv5BptvybHFA@mail.gmail.com>	<ab64c760-eeca-426a-953f-99d7a19919f6@isocpp.org> <CAD6_Qj_SkX1r_Egr0FHgk21ASVQuDkYrn1Cy7+dRAJFwHpG72w@mail.gmail.com>
 <mqvdv7$6tc$1@ger.gmane.org>
 <7066b166-9472-4ad6-ac3c-2db527ed7818@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_468_643451628.1439918611531"
X-Trace: ger.gmane.org 1439918626 17204 80.91.229.3 (18 Aug 2015 17:23:46 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 18 Aug 2015 17:23:46 +0000 (UTC)
Cc: mwoehlke.floss@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBFGUZWXAKGQEJJ2BL7A@isocpp.org Tue Aug 18 19:23:44 2015
Return-path: <std-proposals+bncBCEKFTV6ZUMBBFGUZWXAKGQEJJ2BL7A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f71.google.com ([209.85.218.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBFGUZWXAKGQEJJ2BL7A@isocpp.org>)
	id 1ZRkbs-0002TR-V4
	for gclcip-std-proposals@m.gmane.org; Tue, 18 Aug 2015 19:23:41 +0200
Original-Received: by oiey141 with SMTP id y141sf288650336oie.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 18 Aug 2015 10:23:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:content-type: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=p4WBSRlPS6YpyN+BvK7hGbe6j7rchMifrcHXv485Tmg=;
        b=Y/kv16rLaEUpu1eQ8aGkVG7Kb4Yp8NNq532kiBocPKh75+ANeoIoPX+u0suIpPrCXi
         dgNg9b9SNIGzQlz0b9ofx/P3jV75+YEGCAd+Jp4/gU9IlycvrvBNUeBT6m6uUDzIVY0p
         nrhscdE4xiO6z/Cukqyv5xCVkyGALYo5MfpH5movJR4oTA+FwFacdGplESulKi0sXosU
         znO/sO+SMQ/l7lc4F8YCwxPSRckuqqYGNVYhr1anX+sk8k47bkdZLESZPdaew3OVBOt9
         zcO2CHuShuu7ERFoFDSzR4RTn6O4FDRYWkLRpW4xSSdvDpbPLJ1FZJrZvqgZvEIpzSLg
         Gu+g==
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:cc:message-id:in-reply-to
         :references:subject:mime-version:content-type: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=p4WBSRlPS6YpyN+BvK7hGbe6j7rchMifrcHXv485Tmg=;
        b=kmKlt7g6r0d+RI1lVJ6dae8eiq/bL9Q2DOdB8dTOotLq1AYys5H4O86WoNF33P2gC2
         0Eto8JpWQYAWctZ1UlSj8tYr80h5VzL3skVPPpww3GYrJ/bq0mHk4k4PbdbrX3VLEtkh
         QDB+091hrfhmFwRljPLi5BR8d7Gm2kFiO6DEiR7OY3tZTN8PjKuxxpA1kEatryRB7203
         dsGp9PsS+fmVQPpnhDTtyjfsBxGf9WvfNzbkfBCE/bkc8gkuqcRkPnpHCai4s93wfv5O
         EtDfusnWDPvWb/AMV+x5CJCo3Q93XTPaEAI0nAgVdCxz0nlrbAjt69f7Nj9Xj0QTAbVG
         IZdg==
X-Gm-Message-State: ALoCoQk99RzPuloMvGUiLOQBmmWawK/G0Jz1GiiP5M3cJE5UmXA66aUGovURjH/51Tia6p2wwmBZ
X-Received: by 10.107.6.197 with SMTP id f66mr7035221ioi.15.1439918614832;
        Tue, 18 Aug 2015 10:23:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.92.70 with SMTP id a64ls3209987qge.94.gmail; Tue, 18 Aug
 2015 10:23:32 -0700 (PDT)
X-Received: by 10.140.82.85 with SMTP id g79mr101875qgd.35.1439918612125;
        Tue, 18 Aug 2015 10:23:32 -0700 (PDT)
In-Reply-To: <7066b166-9472-4ad6-ac3c-2db527ed7818@isocpp.org>
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-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19899
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19899>

------=_Part_468_643451628.1439918611531
Content-Type: multipart/alternative; 
	boundary="----=_Part_469_1189165838.1439918611531"

------=_Part_469_1189165838.1439918611531
Content-Type: text/plain; charset=UTF-8



On Tuesday, August 18, 2015 at 12:37:55 PM UTC-4, Arthur Tchaikovsky wrote:
>
> I dear to disagree with the statement that the following example is self 
> documenting and easier to read:
> auto c3ptr = new C{.timeout = 1}; 
> How is this^^^ easier to read? And how is this self documenting? Only on 
> surface it seems that it is, both, but when you really think about it it is 
> neither self documenting nor easy to read. Why? Because having only one 
> argument initialized in {}, that is .timeout, leaves us with question, is 
> that the only argument to that class, or are there any other?
>

If I'm looking to understand what `new C{.timeout=1};` means, I don't care 
how many arguments `C` could have in its constructor. From the user's 
perspective, that's simply irrelevant. What matters is what it means to 
pass the value `1` to the `timeout` argument of the constructor.

And since the word `timeout` is there, I can at least take a pretty good 
guess as to what it means.

Remember: the whole point of default arguments is that you *don't have* to 
know about them. To make a function that takes 6 arguments look like a 
function that takes 3. Seeing `default` for an argument is just pointless 
noise, which is necessary only because C++ doesn't allow for positional or 
named arguments.
 

> If so, are those arguments inited by default? If so, how many? Etc.
> Compared to this:
> auto c3ptr = new C(default, 1); // use a shorter timeout 
> It is immediately obvious how many arguments there are and which one of 
> them are default. And as for self documentation?
> auto c3ptr = new C(default, /*timeout*/1); // use a shorter timeout 
>

Comments are not "self documentation". Comments are not checked; *syntax* 
is.

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_469_1189165838.1439918611531
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, August 18, 2015 at 12:37:55 PM UTC-4, =
Arthur Tchaikovsky wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr">I dear to disagree with the statement that the following exampl=
e is self documenting and easier to read:<br>auto c3ptr =3D new C{.timeout =
=3D 1};
<br>How is this^^^ easier to read? And how is this self documenting? Only o=
n surface it seems that it is, both, but when you really think about it it =
is neither self documenting nor easy to read. Why? Because having only one =
argument initialized in {}, that is .timeout, leaves us with question, is t=
hat the only argument to that class, or are there any other?</div></blockqu=
ote><div><br>If I&#39;m looking to understand what `new C{.timeout=3D1};` m=
eans, I don&#39;t care how many arguments `C` could have in its constructor=
.. From the user&#39;s perspective, that&#39;s simply irrelevant. What matte=
rs is what it means to pass the value `1` to the `timeout` argument of the =
constructor.<br><br>And since the word `timeout` is there, I can at least t=
ake a pretty good guess as to what it means.<br><br>Remember: the whole poi=
nt of default arguments is that you <i>don&#39;t have</i> to know about the=
m. To make a function that takes 6 arguments look like a function that take=
s 3. Seeing `default` for an argument is just pointless noise, which is nec=
essary only because C++ doesn&#39;t allow for positional or named arguments=
..<br>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"> If so, are those arguments inited by default? If so, how many? Etc.<br=
>Compared to this:<br>auto c3ptr =3D new C(default, 1); // use a shorter ti=
meout
<br>It is immediately obvious how many arguments there are and which one of=
 them are default. And as for self documentation?<br>auto c3ptr =3D new C(d=
efault, /*timeout*/1); // use a shorter timeout
<br></div></blockquote><div><br>Comments are not &quot;self documentation&q=
uot;. Comments are not checked; <i>syntax</i> is.</div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_469_1189165838.1439918611531--
------=_Part_468_643451628.1439918611531--

.
