220 19896 <CAEhD+6BWGem3qOoWUj26b0ksnuet=wp6RRuN9vkuGHmcr459SA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Andrey Semashev <andrey.semashev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: default arguments
Date: Tue, 18 Aug 2015 19:49:06 +0300
Lines: 38
Approved: news@gmane.org
Message-ID: <CAEhD+6BWGem3qOoWUj26b0ksnuet=wp6RRuN9vkuGHmcr459SA@mail.gmail.com>
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: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1439916554 14280 80.91.229.3 (18 Aug 2015 16:49:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 18 Aug 2015 16:49:14 +0000 (UTC)
Cc: mwoehlke.floss@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXY5TXHWYJRBA6EZWXAKGQEYJFNYKY@isocpp.org Tue Aug 18 18:49:13 2015
Return-path: <std-proposals+bncBCXY5TXHWYJRBA6EZWXAKGQEYJFNYKY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRBA6EZWXAKGQEYJFNYKY@isocpp.org>)
	id 1ZRk4S-0001ON-LL
	for gclcip-std-proposals@m.gmane.org; Tue, 18 Aug 2015 18:49:08 +0200
Original-Received: by ykll84 with SMTP id l84sf135690349ykl.0
        for <gclcip-std-proposals@m.gmane.org>; Tue, 18 Aug 2015 09:49:07 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:cc:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=USwOADMDrfO8++3OF5F7Z5qx30vgIX0v9TjIcs1UVuk=;
        b=cITHEBgm2vpUgPiuFfEFa5pB8p5juuNPraSAc5GZV3+3wxbNxWfBZrLfmXjvWKbePe
         4zXYdgISkqSS4YB5GYSQPnXg3jt4e//wD1tz5jHFInH/7lbifMDlGlWuHzeBLCS140mg
         jxloiSH72ifM7FIx33A5kO9kW0Sdjb1R2jBhOkEznPzhzLIBJ/i5ginTa4ArazPFkTCi
         gmAaUrzJtyA3s4IG2hK3aYQuVQP0G4ShMwnhpIRErUPcYcKeg8jyXTLyHyF/bIw3FW7w
         Ac5CG82FKH4w3PQldrxXf5Y8SxHVrDrgnnfXpyzzqHPCs/wFExfYznL3Bl0+68CLUL6k
         utgw==
X-Gm-Message-State: ALoCoQn5LhrVQNAgQrINsy6lhyiOvUT4fKb0F0XtuWkTKidIGw69YPdobOd2vte8hFoaBMrSSTX9
X-Received: by 10.129.51.6 with SMTP id z6mr6868055ywz.48.1439916547634;
        Tue, 18 Aug 2015 09:49:07 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.66.229 with SMTP id i5ls1311042igt.8.gmail; Tue, 18 Aug
 2015 09:49:06 -0700 (PDT)
X-Received: by 10.107.162.9 with SMTP id l9mr7826577ioe.76.1439916546894;
        Tue, 18 Aug 2015 09:49:06 -0700 (PDT)
Original-Received: from mail-io0-x229.google.com (mail-io0-x229.google.com. [2607:f8b0:4001:c06::229])
        by mx.google.com with ESMTPS id t5si10093888igd.26.2015.08.18.09.49.06
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 18 Aug 2015 09:49:06 -0700 (PDT)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 2607:f8b0:4001:c06::229 as permitted sender) client-ip=2607:f8b0:4001:c06::229;
Original-Received: by iodb91 with SMTP id b91so195624228iod.1
        for <std-proposals@isocpp.org>; Tue, 18 Aug 2015 09:49:06 -0700 (PDT)
X-Received: by 10.107.3.149 with SMTP id e21mr7364081ioi.19.1439916546660;
 Tue, 18 Aug 2015 09:49:06 -0700 (PDT)
Original-Received: by 10.79.98.1 with HTTP; Tue, 18 Aug 2015 09:49:06 -0700 (PDT)
In-Reply-To: <7066b166-9472-4ad6-ac3c-2db527ed7818@isocpp.org>
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of andrey.semashev@gmail.com designates 2607:f8b0:4001:c06::229 as
 permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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:19896
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19896>

On Tue, Aug 18, 2015 at 7:37 PM, Arthur Tchaikovsky <atch.cpp@gmail.com> 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 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.

Your argument works both ways - I cannot tell what other members C has
and how they are initialized by this constructor. In addition I don't
see what the constructor arguments are without looking at the
interface or docs.

> And as for self documentation?
> auto c3ptr = new C(default, /*timeout*/1); // use a shorter timeout

Multi-line comments are evil - they cause problems when you want to
comment a block of code. Besides interface documentation I try to
avoid them as much as possible.

IMHO, the true named member initialization is much more
self-explanatory and less error prone.

-- 

--- 
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/.

.
