220 36866 <CAC+0CCNZXxi9DsmADBbC9Ov6JQrcJHzPdDLtCe7_4-6yOi=GxA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jake Arkinstall <jake.arkinstall@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: String interpolation
Date: Sun, 11 Feb 2018 13:13:07 +0000
Lines: 414
Approved: news@gmane.org
Message-ID: <CAC+0CCNZXxi9DsmADBbC9Ov6JQrcJHzPdDLtCe7_4-6yOi=GxA@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>
 <ff46a2e5-cf65-7612-a284-6163e53b9bc3@scylladb.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a1135615cc9d9c10564ef8543"
X-Trace: blaine.gmane.org 1518354678 26508 195.159.176.226 (11 Feb 2018 13:11:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 11 Feb 2018 13:11:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDCZX3WUUQFRBZMCQHKAKGQEHZVRVII@isocpp.org Sun Feb 11 14:11:14 2018
Return-path: <std-proposals+bncBDCZX3WUUQFRBZMCQHKAKGQEHZVRVII@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f70.google.com ([209.85.218.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDCZX3WUUQFRBZMCQHKAKGQEHZVRVII@isocpp.org>)
	id 1ekrPM-0005zq-J7
	for gclcip-std-proposals@m.gmane.org; Sun, 11 Feb 2018 14:11:04 +0100
Original-Received: by mail-oi0-f70.google.com with SMTP id 24sf6254662oir.20
        for <gclcip-std-proposals@m.gmane.org>; Sun, 11 Feb 2018 05:13:10 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1518354790; cv=pass;
        d=google.com; s=arc-20160816;
        b=KJcUnAHtnVQiZlfDvpAWH8zTkDNWVjV1MC0H3yyy122hMRGaJdM7noHwvIVhUTeAmQ
         TUm3VrBN3RdecpbiHzCVrsHgD9brjOKAXiSXjF56X0JuHSumBbKCpu3pykd7yrdTtR24
         S74W33ggq7LJQHv0AYzAfUlvZNyOzlQDxzsC9vRuQRnm3wLAq27AV2Pj0czXpBAOg9Nu
         /g6FfTV/9NPAz+4IJFhp7Ycp2kpVqxQ1yL60T3KcG2XlvPN436F8TQJHeX2h7s6XbOQc
         qa7ie85wq5awGFTgmqFHtwbuvI9lbnyfksYw3XhN7ETnbOsCklpHP7Ox0MR10H2gUyYX
         rNgw==
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:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=mPJGN39OOfsxgNhfozzvi0E7iL4BnKHVpheJ9SVuTZg=;
        b=ZEquoqQY1/AXsqULKeenYr0jFkUJKp8xbewEOLwJArIeUrE4blZOgEkbRKKE4Xcx33
         Eat+2yBYWr1yxejOBcJHtyH2dTWOvWT3XZ1rW6SQlMO+lplvxwMGJ1KCt8qYgSPL3tLI
         2qJ58cGGXbsFziMsB8NSVzQUQ/earYyErOBKCFMtltt7B2bot84CxA6aW3RSBKp8jbc0
         3H4SiwxumnMYcv4vAeUk94ZxbSlGruSpB2cYeTETLH3VmfwwV8EUJq4dDqfdzJC2yHlE
         9U/tFIaCXNA8l0VPtLGEpp3zoKo56AuIW4GiPaQLmHUBH5LItoJpoqGPo+5MG+5HyaJr
         1DTg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=R9Izn0EA;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jake.arkinstall@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=mPJGN39OOfsxgNhfozzvi0E7iL4BnKHVpheJ9SVuTZg=;
        b=AJMTEjpa3IsoskUzc1CdNeyEsYrDsnxhXndioOWOHUN/Db2vaSHcLomoJRXMoRIxcb
         H6LuP8DWQdbJkJyd86B6sSHLwjYT3rT7dQQgG6NxF38a7neF9/GrKM+uHIJNvBRDeAQm
         BIoVCIXovIxtn5B3i4gT59wjzyQ8vUjBMLL2f+KB1HvClpIAE7hkzLilONGxyVHQOI1E
         j+Jbps+HA97IoonG+7NIz0da83Fhm0vm+TNK+Ht9dWnxXYoDRdBu6UPww8gftr78xIE7
         8l7/7wcx5wPsudO2nqsMv60UT1gCQ+rMCSGHBdGCc3AhCS4YJ9ILIiZ5ORO1ptKd1M2/
         RPNw==
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=mPJGN39OOfsxgNhfozzvi0E7iL4BnKHVpheJ9SVuTZg=;
        b=tA2MHuMTA6zUru1Y7iWQrDFjr5Yp6sDK9hvsyWO62RK4KiwGWsKkiyI9mtP9CExXlZ
         jcBJZdkSXbj2/bfdmMtU5lf96BXWO43g1qoMkpGyxSAMhdKEAskCRwDuVocXbkdqUj4Q
         GhiE7Iag0qnFp+5jcAM+2aNZ5iAlvNR8OOOritBZQ4165e6W5B68hLElMVtbPcoEhW/X
         8H73tIv05AYrzAaUkGHLMekwf83TsPhHHDQf16kCFOZTsEV6TpSu3mYg3kZYNa9N6z8v
         dCG9DikTs6ogY/w7Lcq7Zd8TMb0y2B1lmgRfIaxDvSUR3KrXhN6ru3O0C6CVNRBFNfRY
         2Tzw==
X-Gm-Message-State: APf1xPBB3TJxkiwxMJuy3UA61F9SB68wr100zq5ffgq25wOM2L8X1Plu
	IwyMynVMPjvX3jIgikvm9g6RCQ==
X-Google-Smtp-Source: AH8x226q6D2+U5LSjFfoO+sEtzVuolViyMmen3X7A2Hbz61APr0P/RrNWc11P7wzPNZm8DDvQsANfg==
X-Received: by 10.202.216.133 with SMTP id p127mr4113300oig.19.1518354789897;
        Sun, 11 Feb 2018 05:13:09 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.202.172.206 with SMTP id v197ls1226665oie.7.gmail; Sun, 11 Feb
 2018 05:13:08 -0800 (PST)
X-Received: by 10.202.88.139 with SMTP id m133mr6161631oib.161.1518354788644;
        Sun, 11 Feb 2018 05:13:08 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1518354788; cv=none;
        d=google.com; s=arc-20160816;
        b=avAK2L2Mqw/ljdGpigJZfoy2mAngeAt3285A6CUGw7UgGhi5vsPChda2wv2xYT0Zcx
         pu0lXd31Px90PlRsoFaSi2pBcKTahaJEfTHtIgxxpMm86+3Rmi7CMNSYh/iDduZ1NXFr
         gSCaaD/erzY0cvmezZabsJvpGrYsvztSDoAoA+eLN8Npqc/4fRhvpAMjSJgzA8D+oLwJ
         8dV8TdIF724BW1xK4/X0frG00/hVcvUl97GX/9oZcghNXBv7SPXp/9LrB7+6Vhjm1zNg
         zcArXAV+Fbop6xtYOYDQOD+eaFQRF7U59WAPQM7LXcsuVQjJJD8vhb2rei9sC8CWnnhR
         Zzrg==
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:mime-version
         :dkim-signature:arc-authentication-results;
        bh=MVwRIuBtlm+ChHRjuPaHxBlrysC9Lt8M0eoYRz1gc1M=;
        b=lFHYJnF1Ps9Wa4OwmGccqLhvZt+DqHp1w88Bs3VS89L0PfvGngazQaw+A3z9orb5rZ
         Tot4LVG5ixR+JpFtAy6W+PwRn7DsKyK1QBJAHIj+WbWwscxflAMTmlLMIhyLfdtde0xW
         chGk0n/uSjV4Af4kdwA/mICOsurIym6UTFmj8Rnn79eiiUuzLZlrmiBzc9/FVTyA6Yv8
         ioVspOx2apJghZ4DekdOOQZOWCYWPvgwWthIrtPNNtQDTtqI823julHZQ2xCKKGlEJ3q
         RM7KZurD3jLqCBV5Af4qhTMbctWcYphZol1aEh5e9HadNTF1A2LNfJXU+lPVmPsvLC8U
         Vx5A==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=R9Izn0EA;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jake.arkinstall@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65])
        by mx.google.com with SMTPS id e16sor1391248otj.19.2018.02.11.05.13.08
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 11 Feb 2018 05:13:08 -0800 (PST)
Received-SPF: pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65;
X-Received: by 10.157.7.76 with SMTP id 70mr7224915ote.257.1518354788111; Sun,
 11 Feb 2018 05:13:08 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Sun, 11 Feb 2018 05:13:07 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Sun, 11 Feb 2018 05:13:07 -0800 (PST)
In-Reply-To: <ff46a2e5-cf65-7612-a284-6163e53b9bc3@scylladb.com>
X-Original-Sender: jake.arkinstall@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=R9Izn0EA;       spf=pass
 (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.65 as
 permitted sender) smtp.mailfrom=jake.arkinstall@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE 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: <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:36866
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36866>

--001a1135615cc9d9c10564ef8543
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Horrible is... subjective. Such ideas are dangerous in weak hands, but are
nonetheless available in most interpreted languages.

I like other approach just because it's more in tune with the direction the
language is already going in, but the power of compile-time code injection
is intriguing. In order to make it see it's potential we'd have to add a
bunch of constexpr string functions.

On 11 Feb 2018 13:06, "Avi Kivity" <avi@scylladb.com> wrote:

> On 02/10/2018 07:30 AM, Nicol Bolas wrote:
>
>
>
> On Friday, February 9, 2018 at 5:12:26 PM UTC-5, Marcin Jaczewski wrote:
>>
>>
>>
>> On Friday, February 9, 2018 at 10:13:10 PM UTC+1, Jake Arkinstall wrote:
>>>
>>>
>>>
>>> On 9 Feb 2018 20:51, <inkwizyt...@gmail.com> wrote:
>>>
>>>
>>> Minimal version than could be added to C++ is new string prefix `F`
>>> (because we have `R`, `u`, `u8` and `U` already, and `$` is outside of
>>> source characters) that enable mixing code with string literals.
>>> As Marcel Kr=C3=BCger wrote, language could transform this string liter=
al to:
>>> F"testA{a}test{{B}}"_x; =3D> operator""_x("testA"_x, a, "test{B}"_x); /=
/using
>>> same postfix to parse sub-literals
>>> FR"aa(x{b}y)aa"_x; =3D> operator""_x(R"aa(x)aa"_x, b, R"aa(y)aa"_x); //=
it
>>> have precedence over `R` prefix
>>>
>>>
>>>
>>> Rest will be implemented by library, this mean `F"a {5} b"` will not
>>> compile because there is no matching operator. stl could add this opera=
tor
>>> for `s` postfix, that will use `std::to_string` for conversing all
>>> arguments:
>>> template<typename... Parts>
>>> std::string operator""s(Parts&&... p) { return std::to_string(std::
>>> forward<Parts>(p)) + ...; }
>>>
>>> int main()
>>> {
>>>     auto x =3D F"Test {{a}} =3D {10+5}"s; //x =3D=3D "Test {a} =3D 15"s
>>> }
>>> No iosteam, and even more it could if someone relay desire to have
>>> localizations:
>>>
>>> F"Test {356*10}"_loc("Prod {0} OK!", "fr") =3D=3D "Prod 3.560,00 OK!";
>>>
>>> Only drawback is some template bloat but this is probably acceptable
>>> cost.
>>>
>>>
>>> This is exactly the kind of thing I'm aiming for, although I dont
>>> believe string conversion and concatenation to be the final solution -
>>> unless my recall of benchmarks is out of date, streams are faster than
>>> string concatenation.
>>>
>>> This being said, similar ideas can be applied to utilise the fmt
>>> library, for example.
>>>
>>
>> This is irrelevant, how it will be implemented is QoI, It could be done
>> using `snprintf`, or even not implemented at all, only prefix `F`and its
>> transformation is important.
>>
>> More I think about this more it look as great addition to language:
>> std::string a;
>> int b =3D 0;
>> int c =3D 42;
>> db.run(F"select name as {a}, age as {b} from table where id =3D {c}"_sql=
);
>>
>>
> If how this is implemented is a mere implementation detail, how would you
> make it use bound parameters or otherwise sanitize string inputs? Have we
> learned nothing from Little Bobby Tables <https://xkcd.com/327/>?
>
>
>
> My horrible code injection proposal would make it work. It would transfor=
m
> the thingie above into "prepare_and_execute("select name as ?, age as ?
> from table where id =3D ?", a, b, c)" (ignoring the bad SQL for a minute)=
..
>
>
>
>
>
> Indeed, this seems like a justification to *not* provide this feature.
>
>
> --
> 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/ff46a2e5-cf65-7612-
> a284-6163e53b9bc3%40scylladb.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ff46a2e5-cf=
65-7612-a284-6163e53b9bc3%40scylladb.com?utm_medium=3Demail&utm_source=3Dfo=
oter>
> .
>

--=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/CAC%2B0CCNZXxi9DsmADBbC9Ov6JQrcJHzPdDLtCe7_4-6yO=
i%3DGxA%40mail.gmail.com.

--001a1135615cc9d9c10564ef8543
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Horrible is... subjective. Such ideas are dangerous in we=
ak hands, but are nonetheless available in most interpreted languages.<div =
dir=3D"auto"><br></div><div dir=3D"auto">I like other approach just because=
 it&#39;s more in tune with the direction the language is already going in,=
 but the power of compile-time code injection is intriguing. In order to ma=
ke it see it&#39;s potential we&#39;d have to add a bunch of constexpr stri=
ng functions.</div></div><div class=3D"gmail_extra"><br><div class=3D"gmail=
_quote">On 11 Feb 2018 13:06, &quot;Avi Kivity&quot; &lt;<a href=3D"mailto:=
avi@scylladb.com">avi@scylladb.com</a>&gt; wrote:<br type=3D"attribution"><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
 #ccc solid;padding-left:1ex">
 =20
   =20
 =20
  <div text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"m_837665124437514935moz-cite-prefix">On 02/10/2018 07:30 =
AM, Nicol Bolas
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Friday, February 9, 2018 at 5:12:26 PM UTC-5, Marcin
        Jaczewski wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr"><br>
            <br>
            On Friday, February 9, 2018 at 10:13:10 PM UTC+1, Jake
            Arkinstall wrote:
            <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left=
:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir=3D"auto">
                <div><br>
                  <div><br>
                    <div class=3D"gmail_quote">On 9 Feb 2018 20:51, &lt;<a =
rel=3D"nofollow">inkwizyt...@gmail.com</a>&gt;
                      wrote:<br type=3D"attribution">
                      <blockquote style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
                        <div dir=3D"ltr">
                          <div><br>
                          </div>
                          <div>Minimal version than could be added to
                            C++ is new string prefix `F` (because we
                            have `R`, `u`, `u8` and `U` already, and `$`
                            is outside of source characters) that enable
                            mixing code with string literals.<br>
                            As Marcel Kr=C3=BCger wrote, language could
                            transform this string literal to:<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">F</span><sp=
an style=3D"color:#080">&quot;testA{a}test{{B}}&quot;</span><span style=3D"=
color:#000">_x</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">=3D&gt;</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">operator</span><span style=3D"c=
olor:#080">&quot;&quot;</span><span style=3D"color:#000">_x</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#080">&quot;testA&quot;</spa=
n><span style=3D"color:#000">_x</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> a</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> </span><span style=3D"color:#080">&quot;test{B}&quot;=
</span><span style=3D"color:#000">_x</span><span style=3D"color:#660">);</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#800">//using s=
ame
                                    postfix to parse sub-literals</span><sp=
an style=3D"color:#000"><br>
                                    FR</span><span style=3D"color:#080">&qu=
ot;aa(x{b}y)aa&quot;</span><span style=3D"color:#000">_x</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">=3D&gt;</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">operator</span><span style=3D"color:#080">&quot;&quot;</span><s=
pan style=3D"color:#000">_x</span><span style=3D"color:#660">(</span><span =
style=3D"color:#000">R</span><span style=3D"color:#080">&quot;aa(x)aa&quot;=
</span><span style=3D"color:#000">_x</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> b</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> R</span><span style=3D"color:#080">&quot;aa(y)aa=
&quot;</span><span style=3D"color:#000">_x</span><span style=3D"color:#660"=
>);</span><span style=3D"color:#000"> </span><span style=3D"color:#800">//i=
t have
                                    precedence over `R` prefix</span></div>
                              </code></div>
                            <br>
                            <br>
                            <br>
                            Rest will be implemented by library, this
                            mean `F&quot;a {5} b&quot;` will not compile be=
cause
                            there is no matching operator. stl could add
                            this operator for `s` postfix, that will use
                            `std::to_string` for conversing all
                            arguments:<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:#008">template</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typena=
me</span><span style=3D"color:#660">...</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#606">Parts</span><span style=3D"color:#660">&gt=
;</span><span style=3D"color:#000"><br>
                                    std</span><span style=3D"color:#660">::=
</span><span style=3D"color:#008">string</span><span style=3D"color:#000"> =
</span><span style=3D"color:#008">operator</span><span style=3D"color:#080"=
>&quot;&quot;</span><span style=3D"color:#000">s</span><span style=3D"color=
:#660">(</span><span style=3D"color:#606">Parts</span><span style=3D"color:=
#660">&amp;&amp;...</span><span style=3D"color:#000"> p</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">return</span><span style=3D"color:#000"> std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">to_string</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">forward</span><span style=3D"=
color:#660">&lt;</span><span style=3D"color:#606">Pa<wbr>rts</span><span st=
yle=3D"color:#660">&gt;(</span><span style=3D"color:#000">p</span><span sty=
le=3D"color:#660">))</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">+</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">...;</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">}</span><span style=3D"color:#000"><br>
                                    <br>
                                  </span><span style=3D"color:#008">int</sp=
an><span style=3D"color:#000"> main</span><span style=3D"color:#660">()</sp=
an><span style=3D"color:#000"><br>
                                  </span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"><br>
                                    =C2=A0 =C2=A0 </span><span style=3D"col=
or:#008">auto</span><span style=3D"color:#000"> x </span><span style=3D"col=
or:#660">=3D</span><span style=3D"color:#000"> F</span><span style=3D"color=
:#080">&quot;Test {{a}} =3D
                                    {10+5}&quot;</span><span style=3D"color=
:#000">s</span><span style=3D"color:#660">;</span><span style=3D"color:#000=
"> </span><span style=3D"color:#800">//x =3D=3D &quot;Test {a}
                                    =3D 15&quot;s</span><span style=3D"colo=
r:#000"><br>
                                  </span><span style=3D"color:#660">}</span=
><span style=3D"color:#000"><br>
                                  </span></div>
                              </code></div>
                            <code>No iosteam, and even more it could if
                              someone relay desire to have
                              localizations:<br>
                              <br>
                              <div style=3D"background-color:rgb(250,250,25=
0);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code=
>
                                  <div><span style=3D"color:#000">F</span><=
span style=3D"color:#080">&quot;Test {356*10}&quot;</span><span style=3D"co=
lor:#000">_loc</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#080">&quot;Prod {0} OK!&quot;</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;fr&quot;=
</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">=3D=3D</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#080">&quot;Prod 3.560,00
                                      OK!&quot;</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"><br>
                                    </span></div>
                                </code></div>
                              <br>
                              Only drawback is some template bloat but
                              this is probably acceptable cost.</code></div=
>
                        </div>
                      </blockquote>
                    </div>
                  </div>
                </div>
                <div dir=3D"auto"><br>
                </div>
                <div dir=3D"auto">This is exactly the kind of thing I&#39;m
                  aiming for, although I dont believe string conversion
                  and concatenation to be the final solution - unless my
                  recall of benchmarks is out of date, streams are
                  faster than string concatenation.</div>
                <div dir=3D"auto"><br>
                </div>
                <div dir=3D"auto">This being said, similar ideas can be
                  applied to utilise the fmt library, for example.</div>
              </div>
            </blockquote>
            <div>=C2=A0<br>
              This is irrelevant, how it will be implemented is QoI, It
              could be done using `snprintf`, or even not implemented at
              all, only prefix `F`and its transformation is important.<br>
              <br>
              More I think about this more it look as great addition to
              language:<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">std</span><span style=3D"=
color:#660">::</span><span style=3D"color:#008">string</span><span style=3D=
"color:#000"> a</span><span style=3D"color:#660">;</span><span style=3D"col=
or:#000"><br>
                    </span><span style=3D"color:#008">int</span><span style=
=3D"color:#000"> b </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">0</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>
                    </span><span style=3D"color:#008">int</span><span style=
=3D"color:#000"> c </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">42</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br>
                      db</span><span style=3D"color:#660">.</span><span sty=
le=3D"color:#000">run</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">F</span><span style=3D"color:#080">&quot;select name as {a}=
, age as {b}
                      from table where id =3D {c}&quot;</span><span style=
=3D"color:#000">_sql</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"><br>
                      <br>
                    </span></div>
                </code></div>
            </div>
          </div>
        </blockquote>
        <div><br>
          If how this is implemented is a mere implementation detail,
          how would you make it use bound parameters or otherwise
          sanitize string inputs? Have we learned nothing from <a href=3D"h=
ttps://xkcd.com/327/" target=3D"_blank">Little
            Bobby Tables</a>?<br>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    My horrible code injection proposal would make it work. It would
    transform the thingie above into &quot;prepare_and_execute(&quot;select=
 name
    as ?, age as ? from table where id =3D ?&quot;, a, b, c)&quot; (ignorin=
g the bad
    SQL for a minute).<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">
        <div>Indeed, this seems like a justification to <i>not</i>
          provide this feature.<br>
        </div>
      </div>
    </blockquote>
    <br>
  </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" 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>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ff46a2e5-cf65-7612-a284-6163e53b9bc3%=
40scylladb.com?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank=
">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/ff=
46a2e5-cf65-7612-<wbr>a284-6163e53b9bc3%40scylladb.<wbr>com</a>.<br>
</blockquote></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/CAC%2B0CCNZXxi9DsmADBbC9Ov6JQrcJHzPdD=
LtCe7_4-6yOi%3DGxA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCNZXx=
i9DsmADBbC9Ov6JQrcJHzPdDLtCe7_4-6yOi%3DGxA%40mail.gmail.com</a>.<br />

--001a1135615cc9d9c10564ef8543--

.
