220 19946 <3868cc40-7a3c-4502-891a-50dd952e8196@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: robinsfr@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: default arguments
Date: Thu, 20 Aug 2015 20:13:22 -0700 (PDT)
Lines: 122
Approved: news@gmane.org
Message-ID: <3868cc40-7a3c-4502-891a-50dd952e8196@isocpp.org>
References: <ef9c7cbe-e8f1-4196-83bc-11a1c9b2798c@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_183_1689897880.1440126802365"
X-Trace: ger.gmane.org 1440126806 8722 80.91.229.3 (21 Aug 2015 03:13:26 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 21 Aug 2015 03:13:26 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCQ5LBULYYOBBU5O3KXAKGQEAK5GZZI@isocpp.org Fri Aug 21 05:13:26 2015
Return-path: <std-proposals+bncBCQ5LBULYYOBBU5O3KXAKGQEAK5GZZI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f69.google.com ([209.85.220.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCQ5LBULYYOBBU5O3KXAKGQEAK5GZZI@isocpp.org>)
	id 1ZSclh-0000zi-SP
	for gclcip-std-proposals@m.gmane.org; Fri, 21 Aug 2015 05:13:26 +0200
Original-Received: by paom9 with SMTP id m9sf53507610pao.0
        for <gclcip-std-proposals@m.gmane.org>; Thu, 20 Aug 2015 20:13:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to: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=oP+s53jCWGBJ91bt048jMOXtHM1CcOAVL13H0BmswW4=;
        b=nYC0pgqpIg4Pb08WBLJViyMqjYA6HCOHn3ELAJfn49Rn/ovNguGXby/hKILUTXSvTT
         cFr/qEr/dIVHvHPx8fP3EKaJxLhGjhst/2u/L2isJSUpw9jelUh80B9JtKyjnv83xD0J
         TD/k/JYLnf3KlFrTGstWHhu4t5H7jOUGxvQ8uXOaeU/PnGoMxC+R47XXvwZ4ATNyPQLO
         lHWxH0R4wte6jYgtbcx+FGFjhOSjPBRHlKsYnlc1VVVDIBVpFS1GGpLp5R9dtHYqOjL5
         UXZgr8iyL6QN/HZ7UVuib2kK/oUwkkvEGxHHgUNFBwdy1ug9tc1ERVkGJKP3RfEPg5Ok
         ic1g==
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: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=oP+s53jCWGBJ91bt048jMOXtHM1CcOAVL13H0BmswW4=;
        b=Uuq//7lxu46Jw/GZBpw0QuvuIFRr+ewzniZ5VZgTWgS1jojnA0X9JHqeXJ3vA+dUaw
         h8CGIMF125L+ay2EkiZRiBJrsCO/x8dEF1zbbtTL7CWzvx5ZMGl6x7zVfFyFjCd9oE+u
         vaTHleftTCgX/K+A2KTS/KO0D5ZTaKXRBRrn9+9z+Jyt3CYbLCtvNV2pdllVPbc2TSwb
         OOEU4F4z+IhP6BU/dIQszTdFAhQODhExGPc9+0CrHomBcuTD9G/9UHFKev7rJcNt+SOM
         gIobUq1Q5hfwQwe64RU2JGEQC5YZb7LGdtrfcdLc0siKRD+gr66Hain/W6dBr7eRr8+h
         51QQ==
X-Gm-Message-State: ALoCoQnVkTCuqWPs9mtH1pGfzVfrKgmaump+k5IIzXrlUcZC/pyy4j65AvrUHWHw+JUigMpVZaSX
X-Received: by 10.68.233.100 with SMTP id tv4mr4908236pbc.0.1440126804576;
        Thu, 20 Aug 2015 20:13:24 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.25.130 with SMTP id c2ls399473igg.12.gmail; Thu, 20 Aug
 2015 20:13:23 -0700 (PDT)
X-Received: by 10.50.153.79 with SMTP id ve15mr21385igb.9.1440126803572;
        Thu, 20 Aug 2015 20:13:23 -0700 (PDT)
In-Reply-To: <ef9c7cbe-e8f1-4196-83bc-11a1c9b2798c@isocpp.org>
X-Original-Sender: robinsfr@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:19946
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19946>

------=_Part_183_1689897880.1440126802365
Content-Type: multipart/alternative; 
	boundary="----=_Part_184_522610569.1440126802365"

------=_Part_184_522610569.1440126802365
Content-Type: text/plain; charset=UTF-8

Elegant. I'm tired of function overload permutations and work-around tricks 
like chained setters or passing structures, when all I really want 
sometimes is the default value of a defaultable parameter which isn't the 
last parameter. It's nice to see that two other people have independently 
come to the same idea, you and Daniel Gutson 
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1466.pdf). While 
named parameters may be *even* nicer in general, the two proposals are not 
mutually exclusive.

For example, when I need to update the formatting where most of the 
parameters are defaultable, I can just say:

    ChangeFormat(
        L"Segoe UI"
        );

But that one time I actually need to set an explicit stretch, then I need 
to specify all the parameters before it: :/

    ChangeFormat(
        L"Segoe UI",
        DWRITE_FONT_WEIGHT_NORMAL,
        DWRITE_FONT_STYLE_NORMAL,
        DWRITE_FONT_STRETCH_CONDENSED
        );

When what I really want is simply:

    ChangeFormat(
        L"Segoe UI",
        default,
        default,
        DWRITE_FONT_STRETCH_CONDENSED
        );

You could even combine named parameters with default values (again, they 
are not mutually exclusive proposals):

    ChangeFormat(
        fontFamily: L"Segoe UI",
        fontWeight: default,
        fontSlope: default,
        fontStretch: DWRITE_FONT_STRETCH_CONDENSED
        );

-- 

--- 
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_184_522610569.1440126802365
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Elegant. I&#39;m tired of function overload permutati=
ons and work-around tricks like chained setters or passing structures, when=
 all I really want sometimes is the default value of a defaultable paramete=
r which isn&#39;t the last parameter. It&#39;s nice to see that two other p=
eople have independently come to the same idea, you and Daniel Gutson (http=
://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1466.pdf). While named=
 parameters may be <i>even</i> nicer in general, the two proposals are not =
mutually exclusive.</div><div><br></div><div>For example, when I need to up=
date the formatting where most of the parameters are defaultable, I can jus=
t say:</div><div><br></div><div><div><font face=3D"courier new,monospace">=
=C2=A0=C2=A0=C2=A0 ChangeFormat(<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 L=
&quot;Segoe UI&quot;</font><br></div><div><font face=3D"courier new,monospa=
ce">=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 );</font></div><div><br></div><di=
v>But that one time I actually need to set an explicit stretch, then I need=
 to specify all the parameters before it: :/</div><div><br></div></div><div=
><font face=3D"courier new,monospace">=C2=A0=C2=A0=C2=A0 ChangeFormat(<br>=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 L&quot;Segoe UI&quot;,<br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DWRITE_FONT_WEIGHT_NORMAL,<br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DWRITE_FONT_STYLE_NORMAL,<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DWRITE_FONT_STRETCH_CONDENSED</font></div=
><div><font face=3D"courier new,monospace">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 );</font><br></div><div><br></div><div>When what I really want=
 is simply:</div><div><br></div><div><div><font face=3D"courier new,monospa=
ce">=C2=A0=C2=A0=C2=A0 ChangeFormat(<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 L&quot;Segoe UI&quot;,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 default,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default,<br>=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DWRITE_FONT_STRETCH_CONDENSED</font=
></div><div><font face=3D"courier new,monospace">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 );</font></div><div><font face=3D"arial,sans-serif"><br>=
</font></div><div>You could even=C2=A0combine named parameters with default=
 values (again, they are not mutually exclusive proposals):</div><div><br><=
/div><div><div><font face=3D"courier new,monospace">=C2=A0=C2=A0=C2=A0 Chan=
geFormat(<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fontFamily: L&quot;=
Segoe UI&quot;,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fontWeight: d=
efault,<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fontSlope: default,<b=
r>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fontStretch: DWRITE_FONT_STRET=
CH_CONDENSED</font></div><div><font face=3D"courier new,monospace">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 );</font></div></div></div></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_184_522610569.1440126802365--
------=_Part_183_1689897880.1440126802365--

.
