220 36865 <ff46a2e5-cf65-7612-a284-6163e53b9bc3@scylladb.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Avi Kivity <avi@scylladb.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: String interpolation
Date: Sun, 11 Feb 2018 15:06:42 +0200
Lines: 464
Approved: news@gmane.org
Message-ID: <ff46a2e5-cf65-7612-a284-6163e53b9bc3@scylladb.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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------D4C9F3A332FB9B8A35F1ACB7"
X-Trace: blaine.gmane.org 1518354298 3513 195.159.176.226 (11 Feb 2018 13:04:58 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 11 Feb 2018 13:04:58 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.6.0
To: std-proposals@isocpp.org, Nicol Bolas <jmckesson@gmail.com>
Original-X-From: std-proposals+bncBDHJFOWD7YCRBZP7QDKAKGQEPNR6HTQ@isocpp.org Sun Feb 11 14:04:53 2018
Return-path: <std-proposals+bncBDHJFOWD7YCRBZP7QDKAKGQEPNR6HTQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f71.google.com ([74.125.82.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDHJFOWD7YCRBZP7QDKAKGQEPNR6HTQ@isocpp.org>)
	id 1ekrJB-0008Gl-Hy
	for gclcip-std-proposals@m.gmane.org; Sun, 11 Feb 2018 14:04:41 +0100
Original-Received: by mail-wm0-f71.google.com with SMTP id r9sf1571193wme.8
        for <gclcip-std-proposals@m.gmane.org>; Sun, 11 Feb 2018 05:06:47 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1518354407; cv=pass;
        d=google.com; s=arc-20160816;
        b=ZMqSO7rPugFPgdK5XQ75XMVDiwnQQ2BHZyXVW+h+2LRqoohwLtTT9laCjYkFflVCvo
         5f+BqwLvRa5Az2ptjMXuLtEBBs8ngkz3CxmBC4m2be90K2dkDuVVl45ux/SSn77gafgY
         45tH83975wS2z2BiygIwDFCDbPbJIkH8ryPX2mo7BATSToQgfxoeEwJ47N9BNmUQx0Yx
         khIaWzsFCYY9iQELAMduLXreA9U9LpHHaFU6zpdwxvJf4o/z6NtiUTjX7tBKJyutYlRn
         tVuAeOoKVggk9ORYHXGXbNEIJIPQxteg+anEs8v726QyBd8bynQmgQMgA4Vbnkl2dVB8
         Hj2g==
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:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:from:references
         :to:subject:arc-authentication-results:arc-message-signature
         :dkim-signature:arc-authentication-results;
        bh=mPDMnyi5Sd4c9tu573HRdCKvcUC2umt9BpaMskqexwE=;
        b=uS7Kt95LwVX+g4E9JAMv+A6ZNDvwp+qaEKWv0PH1g9JMO/XyR4YLcXdx3AQQgI3Vct
         X8ZqwW/EorQAfR2y4VkCSP2oCuSi/+WmZCzcMFG78y/u95ZgENX8uud8rPdy5UNwOgES
         UR1GdMrAOhh3YPoYutZxItKVgHRUbSE6rpzl/ubGrN9Ay91/eq9Qk2YNKWrTq/Fe/gf1
         Bcp5rmc8VhA2mIlWsw8y3U8n5pJBATK+GzLdPqfrYFznvKbKW16f7Lk9W/CfJqB5iiIY
         NrRUNw0hdM7zzX613H9wnLRgulA7NFqaue5X/4+qzHUucdDcwcmN23KdQIacK6xVU2AB
         NUxA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@scylladb-com.20150623.gappssmtp.com header.s=20150623 header.b=epRjV7oD;
       spf=pass (google.com: domain of avi@scylladb.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=avi@scylladb.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language: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=mPDMnyi5Sd4c9tu573HRdCKvcUC2umt9BpaMskqexwE=;
        b=BKCfUrmIlWebAFjN6iM04gUiwiyNdsorBW/sVf0PgzazDkQPI3AM4k5nbRkue4zMyt
         EECZDS8quEu34ABJrsHCfp6Pp74ihHsoHu+/q3UuS1steUg24HiDsFfcvCD/Lo6A79gs
         nZU+33yKYXUCYQBbGkIB2/u5SCwpJrz8nJ5+cYtfOWN8T57KeUs0d9Qsmq3Mj4bpmQlD
         WxhtyO6e7OC/Lj+Gbu7JdBhl37c7X7+WVxGHjsX/U8v4EH4lAQ2ESA/XJquShjpf3Too
         u0fem+Mp8mGEpYhSMJNzXJzyJIYkT48fZ+Oip0jXjP7GyUSr/9wHcYEQQ0Ncsn4XEoOD
         M8IQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :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=mPDMnyi5Sd4c9tu573HRdCKvcUC2umt9BpaMskqexwE=;
        b=gWjQnBbBxLnhbXLkIE1zTkQZop0Jhh7QavFAlRYZscmCcjWZv1EQ8FU47kunyzD7OV
         LIzhP6WhNM7o++lBUY9V34PE2vXN8epaT83dvVaabuAWO/64pz3IiP9cFuIG22fcCLK4
         Lah9MLMrH/Sc/etdoscpuE0ZBNL57B9bzlCc1L5g95GCZO0UZpedcTZTVd+mY33AE0LA
         LX3iYSYhpfCs9gOIJH03OltxmAAzeDYKrWMDsqdjYGLTTgkOqvL1HAJVIK1EwlLGi7fn
         wxq0rF5swU3FpgN97z+q3YvfCi0IUGTjKH9t4BajKdwldxB54ZGOx0xXfKPkaDoUCfbr
         d 
X-Gm-Message-State: APf1xPA57Q9hGny12z89YmJP3oZt85vDKJ+OBau5Ior5MeCZGrCaH98m
	yzbe5i50aaNSWGEH25SakpouGQ==
X-Google-Smtp-Source: AH8x225/4Vl59WrWO+dWy1mOiIewcLFqXCxHfLSNyHudQABUs5aDuIdIqN2bYuivLo0s/MGC1+meyg==
X-Received: by 10.28.128.79 with SMTP id b76mr149702wmd.30.1518354406956;
        Sun, 11 Feb 2018 05:06:46 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.223.208.133 with SMTP id y5ls3217892wrh.5.gmail; Sun, 11 Feb
 2018 05:06:45 -0800 (PST)
X-Received: by 10.223.156.207 with SMTP id h15mr6514087wre.281.1518354405412;
        Sun, 11 Feb 2018 05:06:45 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1518354405; cv=none;
        d=google.com; s=arc-20160816;
        b=n4+f4ofNX8KJeZWq/J7W3C6amD8GHC6z+MmQFXLjzYA9vL96u52Fcdk+dVdhr6b+x2
         IyiG+9uIPRXBRDi8Twcgo7cwDwI+cjXSn+7gTi9hICGNoeEghWv9T296T0434tVud5Dg
         ItM0A9SVj4SmdEleTdygUGUT5r0v41+MlYqs4tEH4SsLJnSvZN2j5XUu4ykWYllgMSxQ
         FsF5bB6D0uOLoHwDsZN0swBAU74gNNapGkwrHEE4U1GAcjsKYLuHhyjupBcPGnn4RfOl
         TtuJDG6YThyt8RswvLfsEc41af0O2AootEEJOcAsQoQ4+2UE/cef4bt0fhf+TenabS4r
         6uxQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:dkim-signature
         :arc-authentication-results;
        bh=I19obRmUQYaWyVGSUfXGKF/kspTpNB7/ePi2ZTb85TE=;
        b=wSiaeDX8ssi1oWXQbJKEmGoS7pQMDu3kXn8gLr1Ey9coUYcT4Kp9ZIpMqu2buKJT/5
         kXS0d0zwY8RrHWszDF9klYjJbNfwk5L7RxWnGdNxlZmu0cguc4l7hAuZEpBbVHkZrXXY
         XR0pe4+1IHusP9kb+IbROvfq3+NlpcJ86DEJ7kbLRR5obgfwpI1HLeNyNFHKORQWUTll
         wqhy+kOZRysqQCo/X5jQiykGlN0jghsHGWIsB9t7gPa5c4xSebyMKmYLB8ea54h91MAC
         jJPTrLGspFG3m7UsDX3l32ulmb7tEwdgwEDLtHp9UXWxYhX++aDvi6ip+M0hY0w4Mwfl
         asQQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@scylladb-com.20150623.gappssmtp.com header.s=20150623 header.b=epRjV7oD;
       spf=pass (google.com: domain of avi@scylladb.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=avi@scylladb.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 137sor669531wml.66.2018.02.11.05.06.45
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 11 Feb 2018 05:06:45 -0800 (PST)
Received-SPF: pass (google.com: domain of avi@scylladb.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.28.9.18 with SMTP id 18mr1206947wmj.37.1518354405147;
        Sun, 11 Feb 2018 05:06:45 -0800 (PST)
Original-Received: from [10.0.0.3] (bzq-79-178-1-170.red.bezeqint.net. [79.178.1.170])
        by smtp.googlemail.com with ESMTPSA id 11sm3517322wmp.36.2018.02.11.05.06.43
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 11 Feb 2018 05:06:43 -0800 (PST)
In-Reply-To: <f5feb9a0-99d3-433a-ae46-af34c8d00a61@isocpp.org>
Content-Language: en-US
X-Original-Sender: avi@scylladb.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@scylladb-com.20150623.gappssmtp.com header.s=20150623
 header.b=epRjV7oD;       spf=pass (google.com: domain of avi@scylladb.com
 designates 209.85.220.41 as permitted sender) smtp.mailfrom=avi@scylladb.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:36865
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36865>

This is a multi-part message in MIME format.
--------------D4C9F3A332FB9B8A35F1ACB7
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

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 literal 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 operator for `s` postfix,
>             that will use `std::to_string` for conversing all arguments:
>             |
>             template<typename...Parts>
>             std::stringoperator""s(Parts&&...p){returnstd::to_string(std:=
:forward<Parts>(p))+...;}
>
>             intmain()
>             {
>             autox =3DF"Test {{a}} =3D {10+5}"s;//x =3D=3D "Test {a} =3D 1=
5"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::stringa;
>     intb =3D0;
>     intc =3D42;
>     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=20
> you make it use bound parameters or otherwise sanitize string inputs?=20
> Have we learned nothing from Little Bobby Tables <https://xkcd.com/327/>?
>


My horrible code injection proposal would make it work. It would=20
transform the thingie above into "prepare_and_execute("select name as ?,=20
age as ? from table where id =3D ?", a, b, c)" (ignoring the bad SQL for a=
=20
minute).





> Indeed, this seems like a justification to /not/ provide this feature.

--=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/ff46a2e5-cf65-7612-a284-6163e53b9bc3%40scylladb.=
com.

--------------D4C9F3A332FB9B8A35F1ACB7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"moz-cite-prefix">On 02/10/2018 07:30 AM, Nicol Bolas
      wrote:<br>
    </div>
    <blockquote type=3D"cite"
      cite=3D"mid:f5feb9a0-99d3-433a-ae46-af34c8d00a61@isocpp.org">
      <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.8ex;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" moz-do-not-send=3D"true">inkwizyt.=
...@gmail.com</a>&gt;
                      wrote:<br type=3D"attribution">
                      <blockquote style=3D"margin:0 0 0
                        .8ex;border-left:1px #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);bo=
rder-style:solid;border-width:1px"><code>
                                <div><span style=3D"color:#000">F</span><sp=
an
                                    style=3D"color:#080">"testA{a}test{{B}}=
"</span><span
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">;</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#660">=3D&gt;</span><spa=
n
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#008">operator</span><sp=
an
                                    style=3D"color:#080">""</span><span
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">(</span><span
                                    style=3D"color:#080">"testA"</span><spa=
n
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">,</span><span
                                    style=3D"color:#000"> a</span><span
                                    style=3D"color:#660">,</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#080">"test{B}"</span><s=
pan
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">);</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#800">//using same
                                    postfix to parse sub-literals</span><sp=
an
                                    style=3D"color:#000"><br>
                                    FR</span><span style=3D"color:#080">"aa=
(x{b}y)aa"</span><span
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">;</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#660">=3D&gt;</span><spa=
n
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#008">operator</span><sp=
an
                                    style=3D"color:#080">""</span><span
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">(</span><span
                                    style=3D"color:#000">R</span><span
                                    style=3D"color:#080">"aa(x)aa"</span><s=
pan
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">,</span><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">"aa(y)aa"</span><s=
pan
                                    style=3D"color:#000">_x</span><span
                                    style=3D"color:#660">);</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#800">//it have
                                    precedence over `R` prefix</span></div>
                              </code></div>
                            <br>
                            <br>
                            <br>
                            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 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);bo=
rder-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">typename</span><sp=
an
                                    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><sp=
an
                                    style=3D"color:#080">""</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;...</spa=
n><span
                                    style=3D"color:#000"> p</span><span
                                    style=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"color:#008">return</span><span
                                    style=3D"color:#000"> std</span><span
                                    style=3D"color:#660">::</span><span
                                    style=3D"color:#000">to_string</span><s=
pan
                                    style=3D"color:#660">(</span><span
                                    style=3D"color:#000">std</span><span
                                    style=3D"color:#660">::</span><span
                                    style=3D"color:#000">forward</span><spa=
n
                                    style=3D"color:#660">&lt;</span><span
                                    style=3D"color:#606">Pa<wbr>rts</span><=
span
                                    style=3D"color:#660">&gt;(</span><span
                                    style=3D"color:#000">p</span><span
                                    style=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"color:#660">...;</span><span
                                    style=3D"color:#000"> </span><span
                                    style=3D"color:#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">()</span><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"color:#660">=3D</span><span
                                    style=3D"color:#000"> F</span><span
                                    style=3D"color:#080">"Test {{a}} =3D
                                    {10+5}"</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 "Test {=
a}
                                    =3D 15"s</span><span
                                    style=3D"color:#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,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px"><code>
                                  <div><span style=3D"color:#000">F</span><=
span
                                      style=3D"color:#080">"Test {356*10}"<=
/span><span
                                      style=3D"color:#000">_loc</span><span
                                      style=3D"color:#660">(</span><span
                                      style=3D"color:#080">"Prod {0} OK!"</=
span><span
                                      style=3D"color:#660">,</span><span
                                      style=3D"color:#000"> </span><span
                                      style=3D"color:#080">"fr"</span><span
                                      style=3D"color:#660">)</span><span
                                      style=3D"color:#000"> </span><span
                                      style=3D"color:#660">=3D=3D</span><sp=
an
                                      style=3D"color:#000"> </span><span
                                      style=3D"color:#080">"Prod 3.560,00
                                      OK!"</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'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);bo=
rder-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"color:#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"color:#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
                      style=3D"color:#000">run</span><span
                      style=3D"color:#660">(</span><span
                      style=3D"color:#000">F</span><span
                      style=3D"color:#080">"select name as {a}, age as {b}
                      from table where id =3D {c}"</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"https://xkcd.com/327/" moz-do-not-send=3D"true">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 "prepare_and_execute("select name
    as ?, age as ? from table where id =3D ?", a, b, c)" (ignoring the bad
    SQL for a minute).<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <blockquote type=3D"cite"
      cite=3D"mid:f5feb9a0-99d3-433a-ae46-af34c8d00a61@isocpp.org">
      <div dir=3D"ltr">
        <div>Indeed, this seems like a justification to <i>not</i>
          provide this feature.<br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>

<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/ff46a2e5-cf65-7612-a284-6163e53b9bc3%=
40scylladb.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.googl=
e.com/a/isocpp.org/d/msgid/std-proposals/ff46a2e5-cf65-7612-a284-6163e53b9b=
c3%40scylladb.com</a>.<br />

--------------D4C9F3A332FB9B8A35F1ACB7--

.
