220 36904 <50a06b7a-bd73-4064-8422-56946338cbd1@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: florian.csdt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: String interpolation
Date: Tue, 13 Feb 2018 09:51:15 -0800 (PST)
Lines: 165
Approved: news@gmane.org
Message-ID: <50a06b7a-bd73-4064-8422-56946338cbd1@isocpp.org>
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>
 <CAGg_6+N91RBTk2z6DdyjL0KDzF041f64Z+HuCB1WdvmdJAak0Q@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_12324_1271598919.1518544275650"
X-Trace: blaine.gmane.org 1518544164 8436 195.159.176.226 (13 Feb 2018 17:49:24 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 13 Feb 2018 17:49:24 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC26HM4V3MIRBFGLRTKAKGQE7CX6J4A@isocpp.org Tue Feb 13 18:49:20 2018
Return-path: <std-proposals+bncBC26HM4V3MIRBFGLRTKAKGQE7CX6J4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f200.google.com ([209.85.217.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC26HM4V3MIRBFGLRTKAKGQE7CX6J4A@isocpp.org>)
	id 1elehc-0001QX-Jk
	for gclcip-std-proposals@m.gmane.org; Tue, 13 Feb 2018 18:49:12 +0100
Original-Received: by mail-ua0-f200.google.com with SMTP id g9sf12823607ual.8
        for <gclcip-std-proposals@m.gmane.org>; Tue, 13 Feb 2018 09:51:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=ksQfVwg73iDt7R7Q+MXFUHV83xAoGx/9v7QgWxR/S24=;
        b=Wy9EpJ7gA/+9fU5RVWrlCHLr0MwePWsqcuKRXSiJv8mPhx+FJPbv1PmAA6mQmWJV9W
         uemPE//ZHbYp5vbGAWXZ3SWevY7ljvxErC42y5NARcKpNJfc4NaCUCiHCw+RoSVrU3Le
         VXonM6/FQKYU7rZmzZnaXYFIhz47uyOS20vCsFs37/J3UpRoGxdWLnTZi4GT9UMQVvub
         Xfran03lJpUztBvJQgZdDU/KzRewdcBJOSF2mTBUwEq+wsg81Evd8+zys0F9EKSqdQW7
         N9kcsqm7y9lQEtqPqZiNOoyLwkWlVeOKTdW1iCGtv0+jJj2NO8ILyAwLSCrHedg+AnDz
         gMkg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=ksQfVwg73iDt7R7Q+MXFUHV83xAoGx/9v7QgWxR/S24=;
        b=AcTaTSwfZzRkaTZfIYBRB13M12ulsn0bgy4AO85loAsHSL4ww3QsgfogLytk8LT2WE
         BynRt2VFN2i9N6Lr9wFtAssSxKOO4IW3J0wL9ksh50V3TLCv519Q6ZyEvq/JLJwk9hI+
         +qJGmt6cywyQ9z+jmvJXtIy//Gz9Zc2AiaeG+C0Rhp3ITBrzEb5CcSGYEwGlCdSe5ZQh
         TON8eiYSUyAA/iNywEMYT5j5eyz/FdojIgjeg6bN6KV85teqY8eO6FzRPs4GX2QmAGP7
         yhcpYcpeHLVxULEtWuUtTWWV2SRqBPKmXD5pIcq5fTLU95rRHTqYAOgkoBBUSbr6bTdv
         L18w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version: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=ksQfVwg73iDt7R7Q+MXFUHV83xAoGx/9v7QgWxR/S24=;
        b=Ux9A77k6c0KtsLb8Y6ZS5gesi9r0uXvmOxYIjIk9gZbGzPXmt/whiGSpd9f/pEQRR8
         4R8NLNzfVc+awvf/gfxcSL2IzrS7Onf5ReBa7C40yyr+L0SgStRR4A1eGzgLe8mxCNi5
         QrLYRLTpEEqDtjePJHUdXRihsXDozF2tXOlEZFBjuiWK2un2SRzx96mT7hdRO163+vmP
         OVLUx30ChJmFztnuhqffIyHQa5MOfOFxg7PzbQp54T/1xQdYqIweoZKyt+WYo439Vfw7
         VELrhcxvrmyNP4m0/Fuq5ipgk13s45fG8v9TiOFdUmtVBkMtfSu4pg2K2L1S37C1zvu6
         TSGA==
X-Gm-Message-State: APf1xPAAW21XothgFSBWOw5F1pwtHX7gb0Ig+oFUQNhMxhA1z+rFV8xj
	pCvmKgqLUgu/ccWoJoyS8soecQ==
X-Google-Smtp-Source: AH8x225l52HkOgUtbZgBC3POXbGRdfJDxfRX9OBe8Gr3d30jycuBHlkNWJ1BqBiy7mNTW9Pitnx/Xw==
X-Received: by 10.31.155.87 with SMTP id d84mr970121vke.121.1518544278164;
        Tue, 13 Feb 2018 09:51:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.95.142 with SMTP id t136ls9348563vkb.20.gmail; Tue, 13 Feb
 2018 09:51:16 -0800 (PST)
X-Received: by 10.31.185.13 with SMTP id j13mr89868vkf.8.1518544276115;
        Tue, 13 Feb 2018 09:51:16 -0800 (PST)
In-Reply-To: <CAGg_6+N91RBTk2z6DdyjL0KDzF041f64Z+HuCB1WdvmdJAak0Q@mail.gmail.com>
X-Original-Sender: florian.csdt@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:36904
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36904>

------=_Part_12324_1271598919.1518544275650
Content-Type: multipart/alternative; 
	boundary="----=_Part_12325_393170162.1518544275650"

------=_Part_12325_393170162.1518544275650
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Le mardi 13 f=C3=A9vrier 2018 18:32:44 UTC+1, Nevin ":-)" Liber a =C3=A9cri=
t :
>
> On Tue, Feb 13, 2018 at 11:18 AM, <floria...@gmail.com <javascript:>>=20
> 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=20
>>> 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 no=
t=20
>>> a template, it is considered a better match than the array version. And=
=20
>>> therefore, any ltieral you pass will go through the pointer version rat=
her=20
>>> than the array template.
>>>
>>> And it should be noted that this has nothing to do with being a literal=
..=20
>>> If you used a `const char[]` variable, it *still* would prefer the=20
>>> pointer version due to array->pointer conversion. So this is not a case=
 of=20
>>> "string literals are broken now".
>>>
>>
>> How can you say that preferring a lossy conversion over a lossless one i=
s=20
>> 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=20
> different behavior between the two?
>
> Any choice you make for these will make some users unhappy.
>

4. string literals are not arrays and can have their own rules.

Any choice we make for these will make some users unhappy.
=20

> --=20
>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com <javascript:>>=20
>  +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/50a06b7a-bd73-4064-8422-56946338cbd1%40isocpp.or=
g.

------=_Part_12325_393170162.1518544275650
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Le mardi 13 f=C3=A9vrier 2018 18:32:44 UTC+1, Nevi=
n &quot;:-)&quot; Liber a =C3=A9crit=C2=A0:<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">On Tue, Feb 13, 2018 at 11:18 AM,  <span dir=
=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"EKH0bBfLCgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascr=
ipt:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return=
 true;">floria...@gmail.com</a>&gt;</span> wrote:<br><div><div class=3D"gma=
il_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div><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;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Because i=
t would never be called. Basically, what you&#39;d need is this constructor=
:<br><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(1=
87,187,187);border-style:solid;border-width:1px"><code><div><span style=3D"=
color:#008">template</span><span style=3D"color:#660">&lt;</span><span styl=
e=3D"color:#000">size_t N</span><span style=3D"color:#660">&gt;</span><span=
 style=3D"color:#000"><br>string_view</span><span style=3D"color:#660">(</s=
pan><span style=3D"color:#008">const</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">char</span><span style=3D"color:#000"> s</spa=
n><span style=3D"color:#660">[</span><span style=3D"color:#000">N</span><sp=
an style=3D"color:#660">]);</span></div></code></div><br>But you already ha=
ve this constructor:<br><br><div style=3D"background-color:rgb(250,250,250)=
;border-color:rgb(187,187,187);border-style:solid;border-width: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"color:#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 therefore, any ltier=
al you pass will go through the pointer version rather than the array templ=
ate.<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>still</i> would pref=
er the pointer version due to array-&gt;pointer conversion. So this is not =
a case of &quot;string literals are broken now&quot;.<br></div></div></bloc=
kquote><div><br></div></div></div><div>How can you say that preferring a lo=
ssy conversion over a lossless one is not broken? (Here, we lose the length=
 information)<br></div></div></blockquote><div><br></div><div>Well, you hav=
e to make a choice:</div><div><br></div><div>1.=C2=A0 What do you want to d=
o 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 with &#39;\0&#39;?</d=
iv><div>3.=C2=A0 Given how easy it is to decay an array into a pointer, do =
you want different behavior between the two?</div><div><br></div><div>Any c=
hoice you make for these will make some users unhappy.</div></div></div></d=
iv></blockquote><div><br></div><div>4. string literals are not arrays and c=
an have their own rules.</div><div><br></div><div>Any choice we make for th=
ese will make some users unhappy.<br></div><div>=C2=A0</div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #=
ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>-- <br><div><div dir=3D=
"ltr"><div><div dir=3D"ltr"><div>=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &l=
t;mailto:<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"EKH0bBfLCgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:=
&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return tru=
e;">ne...@eviloverlord.com</a><wbr>&gt; =C2=A0+1-847-691-1404</div></div></=
div></div></div>
</div></div>
</blockquote></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/50a06b7a-bd73-4064-8422-56946338cbd1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/50a06b7a-bd73-4064-8422-56946338cbd1=
%40isocpp.org</a>.<br />

------=_Part_12325_393170162.1518544275650--

------=_Part_12324_1271598919.1518544275650--

.
