220 36903 <CAGg_6+N91RBTk2z6DdyjL0KDzF041f64Z+HuCB1WdvmdJAak0Q@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: String interpolation
Date: Tue, 13 Feb 2018 11:32:00 -0600
Lines: 128
Approved: news@gmane.org
Message-ID: <CAGg_6+N91RBTk2z6DdyjL0KDzF041f64Z+HuCB1WdvmdJAak0Q@mail.gmail.com>
References: <356d5835-f1bf-4699-94f5-0b2d3d0b9c0e@isocpp.org>
 <CAMD6iD9aT26x8GQHnQL+kuj3Rq8fVQSfYYFtvTnFidkf6jU_ag@mail.gmail.com>
 <25CCF885-86AD-4D51-8F5C-C46376D34DE0@gmail.com> <4890431.TR9UepuQra@tjmaciei-mobl1>
 <CALvx3hac77b6Z=EOWzKqynALi1-352OvY0dnnOer8rN6tfa01g@mail.gmail.com>
 <1cdb6300-7397-46d7-bce9-62e6e8dac40b@isocpp.org> <CAC+0CCOSZHaTA=YPSDU8Add7mE_BYcYPRCmGW8TRPtZhdqL8Hw@mail.gmail.com>
 <4bce681e-e729-4124-9322-69291fdb6678@isocpp.org> <f5feb9a0-99d3-433a-ae46-af34c8d00a61@isocpp.org>
 <8e456af5-09c3-461d-8562-30df127e93af@isocpp.org> <bd24b702-025a-4b06-976b-559c779851e1@isocpp.org>
 <f63ed807-c5f6-4997-b03f-b4bc16a70982@isocpp.org> <28e80709-5ebb-44d2-b26d-22cafd681330@isocpp.org>
 <52b86f0a-b3b9-455f-9d4d-0f6b15192c90@isocpp.org> <1e9a5468-6efa-48a2-87ce-6bdb6d5c4e83@isocpp.org>
 <750ecf62-9637-40f4-8585-e3be2780fb46@isocpp.org> <f8f4407b-ecf6-4a4a-b3f6-c65813e3f843@isocpp.org>
 <5b5435db-772e-4c38-8867-f6fbc66d7cec@isocpp.org> <5c51d89a-54b6-490b-87f2-09ed263d8322@isocpp.org>
 <305b7669-0744-473e-9715-807b7e8051b6@isocpp.org> <0ceb2063-d7b6-4cb8-8c5c-c63aceb5b549@isocpp.org>
 <d26b85c2-707b-49a5-a007-617027506dd1@isocpp.org> <41b87b07-1a91-4bca-ba00-5734c09dbe77@isocpp.org>
 <ef8fbc4c-08c0-409e-815b-28e161101231@isocpp.org> <1a7f714d-4a91-4a95-8da4-0c688d18c4c4@isocpp.org>
 <5f8efcc0-f4e9-4518-abe5-5fffeab55083@isocpp.org> <0e0876bb-7a44-45ff-ab9b-6443e78ea59c@isocpp.org>
 <3468ee0c-a44a-437a-a835-0156c623df2e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a114e7102b1c02f05651b6185"
X-Trace: blaine.gmane.org 1518543058 13649 195.159.176.226 (13 Feb 2018 17:30:58 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 13 Feb 2018 17:30:58 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCE35H5S6IDBBOWCRTKAKGQEPBY444Q@isocpp.org Tue Feb 13 18:30:54 2018
Return-path: <std-proposals+bncBCE35H5S6IDBBOWCRTKAKGQEPBY444Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f198.google.com ([209.85.217.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBOWCRTKAKGQEPBY444Q@isocpp.org>)
	id 1elePe-0002Lo-8z
	for gclcip-std-proposals@m.gmane.org; Tue, 13 Feb 2018 18:30:38 +0100
Original-Received: by mail-ua0-f198.google.com with SMTP id f13sf13139452uad.2
        for <gclcip-std-proposals@m.gmane.org>; Tue, 13 Feb 2018 09:32:44 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1518543163; cv=pass;
        d=google.com; s=arc-20160816;
        b=QKBzVpnCfotdZZc3FobpKP2cEY9Zm+Q6N9bYISUh9jGeidYCydlrgYYdm/LCsRrmt6
         q0OENuxPztxQRltttRlQXin+YUdQjvgO5H+aNfLUoGqMEd7oqCgiReesQC2juJRkKmQU
         ENZhIVNCYrCE05U03VUNU4efIvD6e/VSzbpENLVTWNfPP/sCBPUOTqsr5A+h9WzjsIOt
         4PgHBwu/Il33HipcLgOnz4hx47O0YDpSvNwg34uayYnTFjqeszJ3w7eY6fx6nuDa3hE0
         rHLolo0q6DRNpPyadHi70LgyWwU+dxXLk0yMAlgi3sdEoZ5TRDYVZUqykSvho4QXIRKh
         cPjA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:sender:mime-version
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=3E5blvnGVDqR9YPLpDHTPvLLd1o1NxWdxk37o24+Aj8=;
        b=m2ngF4nevJW0W0bw6X4hKxRz1hNI8wYItHjcKBCW8+PQVr6BYgJq5xWgmR3MOZyGdG
         JSFXB/tpBQVVqkzebrMeQAwtdU26bkz85d0Gu6Lr5UbfUbcZR7/YQqswSG5Mx4oPX0GW
         uRUfYJlgpkLskgkc4Kdiqjjd03oS1YN3wxJDzrgendua0/nckl3zWI0N6IzwUprZ5lKl
         dcJQEES6uZN3BDerrWcUI/cFdHqQheiw2VZdhL59lP6Z2cjBq0eKAhlxGK5PwAm5zQtE
         xvRTYorNA1qh0LMkjLkXcWXIcHcalg3mO/AkeXFQcCENQsEsFcjbOveuAAEqZBymLd6N
         bj2Q==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=MqvY32oA;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender: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=3E5blvnGVDqR9YPLpDHTPvLLd1o1NxWdxk37o24+Aj8=;
        b=Ayb1LnX6eocr98bcFpaULlZ8OLc+xrnIelMfi77eDSA8wU86y4Q6ByoWXBqJ3OcwqO
         BJZj1xFRZfrVOnhpW8EtyarcL4Rk1PKBLq7uDayUMycV5UBlO5DmXVkRv6H22wJe8jZ+
         bHoflszzIbXQGmHH3s9ffKhu5p1T8xrF+7PzL3oUUNIDRqIWFM1a5gsxq8yxag7az1mT
         EwwyGObAHU/QRfWayJ0gh1+7Yd1zzBwx3r3vPk7xnUSnh68iEwYdx1wGlte71u6m5OBc
         Holf82cwXAxP3uQsY47NNTg5ex8WgYjSMzruolFEKmo50uCRXtVWszGmvCi019f7mJj8
         UIGw==
X-Gm-Message-State: APf1xPBllzJFcV5vHzg5/NphsdJ83r0e8f4tH/veZrLH4JuvXjXvIRmY
	mAw2aG2HTBfqxO0vmzvapBI=
X-Google-Smtp-Source: AH8x226BdP3LT7rcRgHpJouwVGXCH+OeASnxNd5HrM/L4G/DUmlf7zaPmlWHAvzSxvyyKf11Dy3kRQ==
X-Received: by 10.176.82.196 with SMTP id w4mr909510uaw.50.1518543163854;
        Tue, 13 Feb 2018 09:32:43 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.168.77 with SMTP id r74ls2667711vke.17.gmail; Tue, 13 Feb
 2018 09:32:41 -0800 (PST)
X-Received: by 10.31.106.133 with SMTP id f127mr1881096vkc.94.1518543161813;
        Tue, 13 Feb 2018 09:32:41 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1518543161; cv=none;
        d=google.com; s=arc-20160816;
        b=uR67jbMnieETYR35r6PAdW+Ufuft/HspLKphmBADuj08i7UU00xUB/I8jWfOJHBGGV
         pguj0nQsM5K/KPRRms90huXTXJzezG7P5Ssu8ZyMsNR6CD9zrzfTUYFF69V/Msfh8Hip
         Jo2UsVjOJNjx5H5TWeOivoK50K47ZL4+DBKNc5FrY2V/XK/J9800Xs+UO1G096rkw9WS
         NYhkH7Xmku9sObSxWrJ8/K1lIHN8ed56z5keDVUisLrWojZSJJSNFutIHt4tz8Vk3WWB
         dEYIJMoTWbcn9YRMx8hMSMjyDKkG1fypgVvXosm4FtNabfb5hBXk4tEDRHzdrRDR85nc
         WNYQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:sender
         :mime-version:dkim-signature:arc-authentication-results;
        bh=9wLpRj6HXbTiamQ7FKCclzpNDvQIeZY7TrKpep+OupE=;
        b=lTMZrlhTsbbXrzAr9rpkOgr8adPBLijmXf+w9nOmfiyz8ui9VsRoQMo0IuzqSB2J2P
         PuGO55g6/wz4dORcwrRspDE3qS/r82KE3aGkdKnVPQkUUny1jGqYalUJzV/2C0iRk1nl
         Ma9229/PcaqXANbkTERiZ57rCfZM1Tze4ub2jqiIT3LoNoJEtw34mSWtw1gECr2zeYTI
         lAnJqfxJJglLKQrby+Q2fmqfzX0ip2qVJxu6wrF7LQKvB3Yw6p/ku0UEVucG6iYj52dc
         DZC8i9hVRjjn6UDjy3gpkEl1kO1c7RT4MlXfD7g2CinwmmE53nu4v5DoTENFLlhg2Ssv
         Hcng==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=MqvY32oA;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id h137sor1011533vkd.110.2018.02.13.09.32.41
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Tue, 13 Feb 2018 09:32:41 -0800 (PST)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.31.205.131 with SMTP id d125mr1917591vkg.110.1518543161112;
 Tue, 13 Feb 2018 09:32:41 -0800 (PST)
Original-Sender: nliber@gmail.com
Original-Received: by 10.103.116.134 with HTTP; Tue, 13 Feb 2018 09:32:00 -0800 (PST)
In-Reply-To: <3468ee0c-a44a-437a-a835-0156c623df2e@isocpp.org>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=MqvY32oA;       spf=pass
 (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted
 sender) smtp.mailfrom=nliber@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: <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:36903
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36903>

--001a114e7102b1c02f05651b6185
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 13, 2018 at 11:18 AM, <florian.csdt@gmail.com> wrote:

>
>
> Le mardi 13 f=C3=A9vrier 2018 17:35:49 UTC+1, Nicol Bolas a =C3=A9crit :
>>
>> Because it would never be called. Basically, what you'd need is this
>> constructor:
>>
>> template<size_t N>
>> string_view(const char s[N]);
>>
>> But you already have this constructor:
>>
>> string_view(const char *s);
>>
>> An array decays into a pointer. And since the pointer constructor is not
>> a template, it is considered a better match than the array version. And
>> therefore, any ltieral you pass will go through the pointer version rath=
er
>> than the array template.
>>
>> And it should be noted that this has nothing to do with being a literal.
>> If you used a `const char[]` variable, it *still* would prefer the
>> pointer version due to array->pointer conversion. So this is not a case =
of
>> "string literals are broken now".
>>
>
> How can you say that preferring a lossy conversion over a lossless one is
> not broken? (Here, we lose the length information)
>

Well, you have to make a choice:

1.  What do you want to do with arrays that have embedded '\0's?
2.  What do you want to do with arrays that aren't terminated with '\0'?
3.  Given how easy it is to decay an array into a pointer, do you want
different behavior between the two?

Any choice you make for these will make some users unhappy.
--=20
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404

--=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/CAGg_6%2BN91RBTk2z6DdyjL0KDzF041f64Z%2BHuCB1Wdvm=
dJAak0Q%40mail.gmail.com.

--001a114e7102b1c02f05651b6185
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tue, Feb 13, 2018 at 11:18 AM,  <span dir=3D"ltr">&lt;<=
a href=3D"mailto:florian.csdt@gmail.com" target=3D"_blank">florian.csdt@gma=
il.com</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gm=
ail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=
=3D"h5"><br><br>Le mardi 13 f=C3=A9vrier 2018 17:35:49 UTC+1, Nicol Bolas a=
 =C3=A9crit=C2=A0:<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"ltr">=
<div>Because it would never be called. Basically, what you&#39;d need is th=
is constructor:<br><br><div style=3D"background-color:rgb(250,250,250);bord=
er-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><=
span style=3D"color:#008">template</span><span style=3D"color:#660">&lt;</s=
pan><span style=3D"color:#000">size_t N</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br>string_view</span><span style=3D"co=
lor:#660">(</span><span style=3D"color:#008">const</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">char</span><span style=3D"color=
:#000"> s</span><span style=3D"color:#660">[</span><span style=3D"color:#00=
0">N</span><span style=3D"color:#660">]);</span></div></code></div><br>But =
you already have this constructor:<br><br><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px"><code><div><span style=3D"color:#000">string_view</span><span style=
=3D"color:#660">(</span><span style=3D"color:#008">const</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">char</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">*</span><span style=3D"c=
olor:#000">s</span><span style=3D"color:#660">);</span></div></code></div><=
br>An array decays into a pointer. And since the pointer constructor is not=
 a template, it is considered a better match than the array version. And th=
erefore, any ltieral you pass will go through the pointer version rather th=
an the array template.<br><br>And it should be noted that this has nothing =
to do with being a literal. If you used a `const char[]` variable, it <i>st=
ill</i> would prefer the pointer version due to array-&gt;pointer conversio=
n. So this is not a case of &quot;string literals are broken now&quot;.<br>=
</div></div></blockquote><div><br></div></div></div><div>How can you say th=
at preferring a lossy conversion over a lossless one is not broken? (Here, =
we lose the length information)<br></div></div></blockquote><div><br></div>=
<div>Well, you have to make a choice:</div><div><br></div><div>1.=C2=A0 Wha=
t do you want to do with arrays that have embedded &#39;\0&#39;s?</div><div=
>2.=C2=A0 What do you want to do with arrays that aren&#39;t terminated wit=
h &#39;\0&#39;?</div><div>3.=C2=A0 Given how easy it is to decay an array i=
nto a pointer, do you want different behavior between the two?</div><div><b=
r></div><div>Any choice you make for these will make some users unhappy.</d=
iv></div>-- <br><div class=3D"gmail_signature" data-smartmail=3D"gmail_sign=
ature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=C2=A0Nevin &quot;:-)&qu=
ot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=
=3D"_blank">nevin@eviloverlord.com</a>&gt; =C2=A0+1-847-691-1404</div></div=
></div></div></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/CAGg_6%2BN91RBTk2z6DdyjL0KDzF041f64Z%=
2BHuCB1WdvmdJAak0Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BN91R=
BTk2z6DdyjL0KDzF041f64Z%2BHuCB1WdvmdJAak0Q%40mail.gmail.com</a>.<br />

--001a114e7102b1c02f05651b6185--

.
