220 32082 <CAFdMc-1qSOjSpsDkG0n64k+=ngj85cFPpqaYg5=KZmK1Yx5BQQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "dgutson ." <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Non-last default arguments
Date: Tue, 11 Apr 2017 23:43:41 -0300
Lines: 213
Approved: news@gmane.org
Message-ID: <CAFdMc-1qSOjSpsDkG0n64k+=ngj85cFPpqaYg5=KZmK1Yx5BQQ@mail.gmail.com>
References: <91d734b5-d1f2-773a-b5c2-3b96696a6f0f@scylladb.com>
 <CAFdMc-2Q8FyP-qqJCT-zDj4kfrqQ89G4qdWuWtVJAzDvFuOZ5w@mail.gmail.com>
 <a39f277a-549f-4b4a-881b-09fd1cf4087e@isocpp.org> <23242c11-a20b-9dfe-42fc-7a1ae3195849@scylladb.com>
 <d3ef1ce9-062d-4cb1-8001-0255edc86076@isocpp.org> <58EBA69B.2020902@gmail.com>
 <fb7458cb-d28c-4625-8a90-0a89b05a3622@isocpp.org> <58ECE695.8060601@gmail.com>
 <a08da561-78d7-4dfe-8b22-d03b9b933ebe@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1147e8c42d3949054cef2d8b
X-Trace: blaine.gmane.org 1491965025 11673 195.159.176.226 (12 Apr 2017 02:43:45 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 12 Apr 2017 02:43:45 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBX5IW3DQKGQEJRI6KGY@isocpp.org Wed Apr 12 04:43:40 2017
Return-path: <std-proposals+bncBDE3NBMV6UFBBX5IW3DQKGQEJRI6KGY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f200.google.com ([209.85.161.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBX5IW3DQKGQEJRI6KGY@isocpp.org>)
	id 1cy8Ft-0002uf-T7
	for gclcip-std-proposals@m.gmane.org; Wed, 12 Apr 2017 04:43:38 +0200
Original-Received: by mail-yw0-f200.google.com with SMTP id s39sf6288665ywa.7
        for <gclcip-std-proposals@m.gmane.org>; Tue, 11 Apr 2017 19:43:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :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=6OTDiESv1YhHZiBLscYKDy1fn0VU4jEtACfO6jl1ARs=;
        b=Svr8TmoLBIQv6VQBnSVSWOmTHCTx5EjmdU5GE+6UR02UIf4wcLU12UE/ZnCub82xa8
         jevYB/QYZSeT3eTFxmiPIvEQrO115Hol3NAUBAysuJ8u35wsWAPOhLNO2Te+RTqjTGpv
         zjIwJAQyDBW22RGrKLS1xcTgfR/pMxqidG0e0fo/hpRPokj9M2zEgNJyBWvsCD0+QzjV
         OWWeJP7j8rlNrUszfup17oydiX6b78323+I33/X1Yu7Hq9WhzPx7/rOOXQCHhEWCUwQL
         mIAlUR0kKBsk6lbH9re3o/z3+chtosNL0kmmI0k6L6ZRvDYaanewn6x1v16lLFKDKGww
         tTTQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to: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=6OTDiESv1YhHZiBLscYKDy1fn0VU4jEtACfO6jl1ARs=;
        b=UsDU5mwsJXzKXaJu88uTjbuGszPikdw5kJaBmAz2qc5YOJY6EmBXVFMIKuL7toZjad
         g/2edbbDsk16ZDDIp8Si4Mv7xsq5QHi9XP9h2HwPowdr3yrfa86DfwnQybMR7OCs+MaR
         MAs+WNqqqvZ+n/QpLlctpfINGnLCN0AV6QP/pL+fLxfBXn9FQmUhjZYjyMZvmv2Owz/K
         8QXEpzWPbcwSBrxvYz6HQClg7Tz6bfLLytJcIYnU+S2rD7QRka1ttH64NfUpVoyhTlXW
         Ou+6odyVL4WG/rgCLbOlB1vcmI3pPon0QL8r3eZeeOlunVSVDcMOrgPzWLETAzpH6143
         5dcg==
X-Gm-Message-State: AN3rC/6kgBIt0VFCCk3m2u1MSw4SeIZ+Z/JsYYjfInLadcceuitQFT9gaEazxVt8QjN44Q==
X-Received: by 10.129.160.12 with SMTP id x12mr7559179ywg.90.1491965023661;
        Tue, 11 Apr 2017 19:43:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.56.220 with SMTP id k28ls8110940ote.7.gmail; Tue, 11 Apr
 2017 19:43:42 -0700 (PDT)
X-Received: by 10.37.194.5 with SMTP id s5mr38380105ybf.136.1491965022848;
        Tue, 11 Apr 2017 19:43:42 -0700 (PDT)
Original-Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com. [2607:f8b0:4002:c05::231])
        by mx.google.com with ESMTPS id u5si6272441ybf.310.2017.04.11.19.43.42
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 11 Apr 2017 19:43:42 -0700 (PDT)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 2607:f8b0:4002:c05::231 as permitted sender) client-ip=2607:f8b0:4002:c05::231;
Original-Received: by mail-yw0-x231.google.com with SMTP id j9so6465175ywj.3
        for <std-proposals@isocpp.org>; Tue, 11 Apr 2017 19:43:42 -0700 (PDT)
X-Received: by 10.129.95.67 with SMTP id t64mr2186386ywb.18.1491965022377;
 Tue, 11 Apr 2017 19:43:42 -0700 (PDT)
Original-Received: by 10.129.162.148 with HTTP; Tue, 11 Apr 2017 19:43:41 -0700 (PDT)
Original-Received: by 10.129.162.148 with HTTP; Tue, 11 Apr 2017 19:43:41 -0700 (PDT)
In-Reply-To: <a08da561-78d7-4dfe-8b22-d03b9b933ebe@isocpp.org>
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 danielgutson@gmail.com designates 2607:f8b0:4002:c05::231 as permitted
 sender) smtp.mailfrom=danielgutson@gmail.com;       dmarc=pass (p=NONE
 sp=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-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:32082
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32082>

--001a1147e8c42d3949054cef2d8b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

El 11/4/2017 12:57, "Nicol Bolas" <jmckesson@gmail.com> escribi=C3=B3:

On Tuesday, April 11, 2017 at 10:22:16 AM UTC-4, Matthew Woehlke wrote:
>
> On 2017-04-10 23:10, Arthur O'Dwyer wrote:
> > On Monday, April 10, 2017 at 8:37:03 AM UTC-7, Matthew Woehlke wrote:
> >> On 2017-04-07 19:09, Arthur O'Dwyer wrote:
> >>> You might look into how Boost does it with boost::use_default. I
> >>> haven't looked myself and can't promise anything, but I gather
> >>> that several Boost libraries have something like this:
> >>>
> >>> inline struct use_default_t {} use_default;
> >>> template<class T, T default_value> struct defaulted {
> >>>   optional<T> value;
> >>>   defaulted(T);
> >>>   defaulted(use_default_t);
> >>>   operator T() const;
> >>> };
> >>>
> >>> void f(defaulted<int, 1> a, defaulted<int, 2> b, defaulted<int, 3> c,
> >>> defaulted<int, 4> d);
> >>
> >> Ugh; you've promoted changing the default from a SIC to a BIC.
> >
> > (I guess "SIC"=3D"syntactic interface change" and "BIC"=3D"binary inter=
face
> > change". Consider spelling these abbreviations out on first reference.)
>
> Anyone that has ever read qt-devel knows these. Alas, Google is
> unusually unhelpful here.
>
> SIC =E2=86=92 Source Incompatible Change
> BIC =E2=86=92 Binary Incompatible Change
>
> (There are also SC and BC =E2=86=92 Source/Binary Compatible.)
>
> Actually, I realize that's slightly wrong. Changing a "normal" default
> means that the code will still run, but recompiling will change the
> behavior, so while it's technically both SC and BC, it is (potentially)
> behavior breaking. (If done carefully, however, it can be okay to make
> such a change.) Changing a "boost style default" not only (maybe)
> changes behavior when the program is recompiled, it *is* an actual BIC,
> i.e. your program will crash until it is recompiled because the ABI
> changed.
>

If default arguments are going to be made more complicated, then I would
genuinely want them to become part of the function's ABI. The current
situation, where they're just a bit of syntacitc sugar, is fine for the
simplest of cases. But when you get function calls like `func(default,
value, value2, default, value3)`, I think it's really important that if
that interface changes, everyone who call the function with them will need
to be recompiled.


Quite off topic but still relevant and familiar: I do prefer to solve
default template arguments than function arguments.
Many times I found myself trying to see what type of allocator or whatever
defsult template argument was used in order to specify the next one.
The trivial useless case, *just* to be illustrative:
    unordered_map<Key, T, default, myAllocator>.



That's why I think using named parameters via designated initilizers is
really the way to go to get this behavior.

--=20
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/a08da561-78d7-4dfe-
8b22-d03b9b933ebe%40isocpp.org
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/a08da561-78d7=
-4dfe-8b22-d03b9b933ebe%40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter=
>
..

--=20
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 e=
mail 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/CAFdMc-1qSOjSpsDkG0n64k%2B%3Dngj85cFPpqaYg5%3DKZ=
mK1Yx5BQQ%40mail.gmail.com.

--001a1147e8c42d3949054cef2d8b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><div class=3D"gmail_extra"><br><div class=3D"gma=
il_quote">El 11/4/2017 12:57, &quot;Nicol Bolas&quot; &lt;<a href=3D"mailto=
:jmckesson@gmail.com">jmckesson@gmail.com</a>&gt; escribi=C3=B3:<br type=3D=
"attribution"><blockquote class=3D"quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"elide=
d-text">On Tuesday, April 11, 2017 at 10:22:16 AM UTC-4, Matthew Woehlke wr=
ote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex">On 2017-04-10 23:10, Arthur O&#=
39;Dwyer wrote:
<br>&gt; On Monday, April 10, 2017 at 8:37:03 AM UTC-7, Matthew Woehlke wro=
te:
<br>&gt;&gt; On 2017-04-07 19:09, Arthur O&#39;Dwyer wrote:=20
<br>&gt;&gt;&gt; You might look into how Boost does it with boost::use_defa=
ult. I=20
<br>&gt;&gt;&gt; haven&#39;t looked myself and can&#39;t promise anything, =
but I gather
<br>&gt;&gt;&gt; that several Boost libraries have something like this:
<br>&gt;&gt;&gt;
<br>&gt;&gt;&gt; inline struct use_default_t {} use_default;=20
<br>&gt;&gt;&gt; template&lt;class T, T default_value&gt; struct defaulted =
{=20
<br>&gt;&gt;&gt; =C2=A0 optional&lt;T&gt; value;=20
<br>&gt;&gt;&gt; =C2=A0 defaulted(T);=20
<br>&gt;&gt;&gt; =C2=A0 defaulted(use_default_t);=20
<br>&gt;&gt;&gt; =C2=A0 operator T() const;=20
<br>&gt;&gt;&gt; };=20
<br>&gt;&gt;&gt;
<br>&gt;&gt;&gt; void f(defaulted&lt;int, 1&gt; a, defaulted&lt;int, 2&gt; =
b, defaulted&lt;int, 3&gt; c,=20
<br>&gt;&gt;&gt; defaulted&lt;int, 4&gt; d);=20
<br>&gt;&gt;
<br>&gt;&gt; Ugh; you&#39;ve promoted changing the default from a SIC to a =
BIC.=20
<br>&gt;=20
<br>&gt; (I guess &quot;SIC&quot;=3D&quot;syntactic interface change&quot; =
and &quot;BIC&quot;=3D&quot;binary interface=20
<br>&gt; change&quot;. Consider spelling these abbreviations out on first r=
eference.)
<br>
<br>Anyone that has ever read qt-devel knows these. Alas, Google is
<br>unusually unhelpful here.
<br>
<br>SIC =E2=86=92 Source Incompatible Change
<br>BIC =E2=86=92 Binary Incompatible Change
<br>
<br>(There are also SC and BC =E2=86=92 Source/Binary Compatible.)
<br>
<br>Actually, I realize that&#39;s slightly wrong. Changing a &quot;normal&=
quot; default
<br>means that the code will still run, but recompiling will change the
<br>behavior, so while it&#39;s technically both SC and BC, it is (potentia=
lly)
<br>behavior breaking. (If done carefully, however, it can be okay to make
<br>such a change.) Changing a &quot;boost style default&quot; not only (ma=
ybe)
<br>changes behavior when the program is recompiled, it *is* an actual BIC,
<br>i.e. your program will crash until it is recompiled because the ABI cha=
nged.
<br></blockquote></div><div><br>If default arguments are going to be made m=
ore complicated, then I would genuinely want them to become part of the fun=
ction&#39;s ABI. The current situation, where they&#39;re just a bit of syn=
tacitc sugar, is fine for the simplest of cases. But when you get function =
calls like `func(default, value, value2, default, value3)`, I think it&#39;=
s really important that if that interface changes, everyone who call the fu=
nction with them will need to be recompiled.<br></div></div></blockquote></=
div></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">Quite off top=
ic but still relevant and familiar: I do prefer to solve default template a=
rguments than function arguments.</div><div dir=3D"auto">Many times I found=
 myself trying to see what type of allocator or whatever defsult template a=
rgument was used in order to specify the next one.</div><div dir=3D"auto">T=
he trivial useless case, *just* to be illustrative:</div><div dir=3D"auto">=
=C2=A0 =C2=A0 unordered_map&lt;Key, T, default, myAllocator&gt;.</div><div =
dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto"><div c=
lass=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"quote"=
 style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr"><div><br>That&#39;s why I think using named parameters via d=
esignated initilizers is really the way to go to get this behavior.<br></di=
v></div><div class=3D"quoted-text">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a08da561-78d7-4dfe-8b22-d03b9b933ebe%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/a08d=
a561-78d7-4dfe-<wbr>8b22-d03b9b933ebe%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div></div></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/CAFdMc-1qSOjSpsDkG0n64k%2B%3Dngj85cFP=
pqaYg5%3DKZmK1Yx5BQQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-1qSO=
jSpsDkG0n64k%2B%3Dngj85cFPpqaYg5%3DKZmK1Yx5BQQ%40mail.gmail.com</a>.<br />

--001a1147e8c42d3949054cef2d8b--

.
