220 36879 <CAC+0CCOV7Qf21J-MBpdggkkrNt8Hs2dN03o52F0s-QXY6f=cbw@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: Mon, 12 Feb 2018 14:38:47 +0000
Lines: 691
Approved: news@gmane.org
Message-ID: <CAC+0CCOV7Qf21J-MBpdggkkrNt8Hs2dN03o52F0s-QXY6f=cbw@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a11c022f001c410056504d601"
X-Trace: blaine.gmane.org 1518446224 7762 195.159.176.226 (12 Feb 2018 14:37:04 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 12 Feb 2018 14:37:04 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDCZX3WUUQFRB6ONQ3KAKGQE2LBRINA@isocpp.org Mon Feb 12 15:37:00 2018
Return-path: <std-proposals+bncBDCZX3WUUQFRB6ONQ3KAKGQE2LBRINA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f71.google.com ([209.85.218.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDCZX3WUUQFRB6ONQ3KAKGQE2LBRINA@isocpp.org>)
	id 1elFDo-0000m8-Mf
	for gclcip-std-proposals@m.gmane.org; Mon, 12 Feb 2018 15:36:45 +0100
Original-Received: by mail-oi0-f71.google.com with SMTP id l66sf7602927oih.23
        for <gclcip-std-proposals@m.gmane.org>; Mon, 12 Feb 2018 06:38:50 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1518446330; cv=pass;
        d=google.com; s=arc-20160816;
        b=SOiAztUfFbxkFImF8gPjUsrGLKW0PM0wFn0osiWkl4JotCdXyBbKMVcYXibDJIuOlo
         ZdejtR2CszK2rEAJuwv4GtPnTbcuPsQ7Krr58JKittBUQxUlWQQQSlN6azj8qa+Li+1X
         tksQ3tp+jNI2nBhVtVu4RuoNA1L7L1a/uONa3N6JhhtKXRjgrALvvA3h8qbmYOf7Akje
         V5bN0DXfpA24SWAJbpcPucHBITMCwAzZ8CVzv+pOMud504mr9NTmkbNBYhDRfHjydq7p
         vh4k/TXTyTnbbQVEBUoAamtl1nReItiRASjGYvR7n+daEZDi+iEb4synrEcIdJFfxBAH
         mBcA==
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=9TBd/sS77k+M6y1Zj/qc1C+qGJ44sa305fYfdFJlvMs=;
        b=LEiHd7QC9GNC3vhFXHkSdDQ6IA1HoLsfExoHz4Bo1vTCdac3Z48lc7ZRSHUqwg4VwI
         uk2qOg6R02mgotAds8tzc6vgfrd92cax12IjwKxI5dHWaFu2U/IuW48D2xPzzKUQ4R6d
         UCCZu7WZ3S8SBWPfCpzOZJ9ArcpctgGlgZEqhrW5Nt4iLVT5AzmMw/jfyYL+ngvP99sr
         Bgu06GiXg5xr3ysfLGiYxtVDL5v8LQvAQ0cfucDDmZ5H3do1Ty2eBLKRkoEocw0OMJd8
         j/gaTjbWRPXQq0KOTArJvN9va9PEUnmw0j8xO+7y7LYG9a4RseMEkBQSo/jpTq7TntzB
         6JRg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=cdUPunbd;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 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=9TBd/sS77k+M6y1Zj/qc1C+qGJ44sa305fYfdFJlvMs=;
        b=MJdc9BT98RVPRH0fq9Hi4rLIIRkjBJjQTRqYTnlU9TDvcIDxVo1LhYqLE9saoBGipe
         K03yCwNdVDfJLntJvSY0OL6MlnpEQYBt/3dWcW8soE0En/GYIa+cwbvNh5G6LNC9JZCN
         pIpKPGPr+HxpgDDo63uLJHl0Ttv/NHfMZPo+EfN2cOjzlaLb5T3qIogdDHw0F5p3ineM
         jGpRBx8aQBAiaG/a4hGk0M5OtmbgdQBcB+F20ozUFZOofMCO1gaX1qcLknKGLsa6lAvc
         Yrh1q8mFbcpPhNmFHrjSznmzTUa+dMiuin5zAV/i95an5xoA2SELNKbfOhBnWukimZKS
         l6Ng==
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=9TBd/sS77k+M6y1Zj/qc1C+qGJ44sa305fYfdFJlvMs=;
        b=d1cu8WSS5BrYrQVMhO+ieDnYNTNgrdGt5stnVyqBmDhfTe31H72/YPZ94M88JODZpe
         uCLSAp0BkM04jT0PxuYDY2UZqG0saOCzheGdgGWo3LFg+y2BvRBq8o2roNtAOlXWMEhn
         tq64DQ+uTsWQqV4u2WTo88PnrOnm804T/X7vkCNTdz3wAEZq1KP9ZqiCknmn7bd4Q9CB
         Kro9QC8Ui8yHEyZjdDOMDuHRcyUab0Ht3PoU+jTu+MQzNNP4A3DBlvrZpg1X8sV5dOgx
         T2n9Tj5rP6AE0GxzvShzWoRAKAY94jL3wTTbLmlkXF1Q0maVModjZC+MdFQZ9CaHvp+x
         PVEQ==
X-Gm-Message-State: APf1xPCRkwdKWn6IASOZouLonMPo9a4q9hrJ/dJYnud96bG8KvfV5jbG
	rJjyiy+xLnxWkcYq1UCz6/rFsQ==
X-Google-Smtp-Source: AH8x227KkQ9DaKBp2g9veyn9KIEwwdwtOUtehvhdDe92iNvmDg+AbSgOH8SnDZElfecr/zkjbOS0MQ==
X-Received: by 10.202.83.13 with SMTP id h13mr6603687oib.121.1518446330174;
        Mon, 12 Feb 2018 06:38:50 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.44.249 with SMTP id e54ls4762965otd.16.gmail; Mon, 12 Feb
 2018 06:38:48 -0800 (PST)
X-Received: by 10.157.32.13 with SMTP id n13mr8772250ota.35.1518446328839;
        Mon, 12 Feb 2018 06:38:48 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1518446328; cv=none;
        d=google.com; s=arc-20160816;
        b=dl+/ih1RRFcbHFciXKT4dHVBC+Dc8cdsrjEz5jy9+ofoi/+GF5+JLzfdYMgEFuLqCs
         p39DLEBfK1eo5tQQ9VFohcMvRHjqtiPAhxzTxPw/WGmfNw1XegDJ5ZvjSXsBiuPrKrqv
         ZRRCR4pAU5HI4iAt+g1K+ZSosk6bLJvW4zWCIdsU4oVIkXGeAfH2vMnIUZQYmXnp4stL
         ZMXxKbtCh1828HbkOKI8L1ywG4lxQKRXlAjyMdFuYAwhmY+FHrQmEwL+lzOrO6dMMdPl
         4qWXhqSPOmsslDSghArylPH2Dqew6rlpDxYCKLEbbZbKCTbwE9bU4KRNOWRw4nr64mNS
         CIkg==
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=tYD++UV+UpK+0fGX73xor2z6Hb8vzonZ2Cmw0VRd4eU=;
        b=vEAlfaRJLKZ7TT1WY8j+2UXBtf8AbWGAoPQY+Tk1fAXvOQgCFcZgLfcAbvBFixYfU2
         KEhYOWOY/hfgs+53aTrhIvIOi+48fKYKVGyFg4j02zQR4KJEkLG46vLPQMylq7pE7i/R
         tw568+o7WXNwm6b2dcim2ZjRFqa9eWiut2VFpIEl6PajjMQjgaNMvm2NR/BPFzTgS7+n
         aIwIVLL5O5mvHbdhqNqJqCliJ0VnVwiCD43nrf7dKbeLInV1jowwYx/R000zmbHzLMPM
         b/kE2dIwr3kVtfAt3YrGJInoQPuZ0tXZ9QihhbJ7FYFVlpMQjPv9Ral6VJNW0dZLn/4r
         SOdQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=cdUPunbd;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 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-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id w42sor3796026otw.60.2018.02.12.06.38.48
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Mon, 12 Feb 2018 06:38:48 -0800 (PST)
Received-SPF: pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.157.60.51 with SMTP id q48mr8508911otc.288.1518446328266;
 Mon, 12 Feb 2018 06:38:48 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Mon, 12 Feb 2018 06:38:47 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Mon, 12 Feb 2018 06:38:47 -0800 (PST)
In-Reply-To: <750ecf62-9637-40f4-8585-e3be2780fb46@isocpp.org>
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=cdUPunbd;       spf=pass
 (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 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:36879
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36879>

--001a11c022f001c410056504d601
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Is recursion a reasonable request in the proposal too? I actually can't
think of WHY one would want it, but it might be worth a discussion for
completeness.

Nicol, what are your thoughts on Florian's suggestion?

In the interest of grounding ourselves (although I'm getting quite excited
here), does anybody from the compiler community have any input as to any
stumbling blocks in the implementation of this?


On 12 Feb 2018 10:17, <florian.csdt@gmail.com> wrote:

Let me suggest something close to Nicol's solution, but not quite.

The F"" operator returns a special type that could be like a simple tuple
(let's name it std::string_processing for now).

Then the user can use it directly into its own functions.


auto column =3D "col"s;
auto table =3D "tab"sv;
auto req =3D sql(F"select {column} from {table};");

// would be equivalent to:
auto req =3D sql(std::string_processing<const char[8]&, std::string&, const
char[7]&, std::string_view&, const char[2]&>("select ", column, " from ",
table, ";"));

Now, if we want, we could also support UDL (but not mandatory) by allowing
to call UDL on the std::string_processing:

auto column =3D "col"s;
auto table =3D "tab"sv;
auto req =3D F"select {column} from {table};"_sql;

// would be equivalent to:
auto req =3D operator ""_sql (std::string_processing<const char[8]&, std::
string&, const char[7]&, std::string_view&, const char[2]&>("select ",
column, " from ", table, ";"));

Now let's have some examples of it could be:

Simple string concatenation would be simple
auto concatenated =3D F"{str1}{str2}{str3}"s;
// converted into an efficient concatenation of the 3 strings

We could print it into an iostream if we want (but would be here only for
convenience on legacy code)
std::cout << F"{str1}{str2}\n";
// equivalent to:
std::cout << str1 << str2 << "\n";

It could be implicitly convertible to a std::string (only if variables are
implicitly convertible to std::string)
std::string concatenated =3D F"{str1}{str2}";

(No example with FMT as I don't know how it works, but I don't see any
reason for it not to be compatible with FMT.)

And this would be constexpr-able.

Now, formatting would require a bit more elaborated type that could store
formatting information.
But in the end, only the user will know what to do with it.
However, I would prefer *not* to embed formatting in such a type, just to
keep it simple. And use a library based solution when I really need
formatting.

It has all the advantages of Nicol's solution, while being more versatile.

Florian


Le dimanche 11 f=C3=A9vrier 2018 19:08:45 UTC+1, Nicol Bolas a =C3=A9crit :
>
> Your new idea is really no better than the old one. The problem comes bac=
k
> to the same point: you are conflating two fundamentally distinct
> operations: the operation to be applied to each string fragment, and the
> operation to be applied to aggregate the fragments into a whole.
>
> Your first idea involved the use of two UDL overloads, thereby tightly
> coupling the two operations. Your second idea only uses one UDL overload,
> but it still tightly couples the two operations by forcing all string
> fragments to use the "same type". Or more specifically, to use the same
> string fragment processed template: `std::string_literal`.
>
> In 99% of cases, you don't need to do character-by-character analysis of
> such literals. A simple array of characters will do. This is why the UDL
> definition syntax doesn't *force* you to process all literals by
> characters of a template parameter. It certainly gives you that option, b=
ut
> it is not forced on you.
>
> There is no reason why string interpolation should force this upon you.
> With my way, you can *choose* to process the fragments this way:
>
> template <char... chars>
> auto operator ""literal() {return std::string_literal<chars...>{};}
>
> std::do_something(F"some string {variable}"literal);
>
> But you aren't *required* to. You can choose how you want to process
> those fragments. The 99% of cases that work just fine with `const char*`s
> or whatever don't have to deal with this `std::string_literal` type. The =
1%
> of template metaprogramming heavy cases have this available as an option.
>
> Exceptional circumstances should be optional, not the default.
>
> I do not understand your fervent insistence on using UDLs to provide the
> aggregation function to be called, rather than explicitly calling an actu=
al
> function. It doesn't even make sense conceptually.
>
> On a conceptual level, a UDL operation produces an object. But not all
> aggregation operations on an interpolated string will produce an "object"=
;
> I see no reason why I can't do this:
>
> std::output(std::cout, F"some string {variable}");
>
> This just writes the individual members of the interpolated string to the
> given output stream. No object is being generated; I'm simply invoking a
> process.
>
> Something similar goes for your SQL database operation:
>
> db.exec(F"some sql stuff {var1} more sql {var2};");
>
> No object needs to be created; you're just running a command.
>
> Using UDLs to invoke the aggregation operation is just the wrong concept.
>
> On Sunday, February 11, 2018 at 9:20:28 AM UTC-5, Marcin Jaczewski wrote:
>>
>> On Sunday, February 11, 2018 at 9:35:50 AM UTC+1, Nicol Bolas wrote:
>>>
>>> On Saturday, February 10, 2018 at 9:38:20 PM UTC-5, Marcin Jaczewski
>>> wrote:
>>>>
>>>> And then wat result will be of:
>>>> auto x =3D F"A {42} B"_z;
>>>>
>>>> If it work as pack expansion then it do not have meaning on its own.
>>>>
>>>
>>> You say that like it's a bad thing. Does `pack...` have meaning on its
>>> own?
>>>
>>>
>> You can use pack expansion only in specific places:
>>
>
> I know that. My point was that we already have grammatical constructs lik=
e
> that which only work in a limited number of places. What is wrong with
> making string interpolation work that way?
>
> The point of my idea is that it provides a sharp separation between the
>>> two fundamental operations of "string interpolation". There's the "conv=
ert
>>> a string literal into a bunch of smaller literals and variables" part. =
And
>>> there's the "do something with that bunch of smaller literals and
>>> variables."
>>>
>>> By making part 1 into a pack expansion-like construct, it forces you to
>>> make the way you want to process that expansion *explicit*. It also
>>> makes a clear distinction between a UDL used for normal purposes and th=
e
>>> system used to process code.
>>>
>>>
>> But this work in this way in C# and JavaScript (and probably other
>> languages too), C# return final string (or interface that you can tweak
>> result a bit) and JS return fully processed object from tag function.
>> My approach mimic it.
>>
>
> C++ has many language features that do similar things from other language=
s
> but in different ways. Lambdas are pretty unique in C++, as are the way w=
e
> handle variadic parameters and expansion (most languages make you index t=
he
> variadic list; we allow you to write patterns and expand them in-situ).
> Indeed, every language has its own specific quirks and distinctions. I se=
e
> no reason to exactly mimic other languages when we can make the mechanism
> so much more flexible than what you're proposing.
>
> Not unless it actually gains us something.
>
> You can't change return type based on `char*` value (this was what Marcel
>> used in his version), this would require `constexpr` arguments that
>> probably will be never added to language.
>>
>
> `constexpr` programming is not based on a 1:1 mapping between "type" and
> "value"; it's based on regular C++ programming principles. On using
> different *values* for those types; we're just doing it at compile time
> instead of runtime. That's why its much better than trying to use templat=
e
> metaprogramming.
>
> In short, you don't *need* it to work this way. Once we can actually
> create and manipulate strings at compile time, there's little point to
> using metaprogramming to process them.
>
> --
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/750ecf62-9637-40f4-
8585-e3be2780fb46%40isocpp.org
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/750ecf62-9637=
-40f4-8585-e3be2780fb46%40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter=
>
..

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAC%2B0CCOV7Qf21J-MBpdggkkrNt8Hs2dN03o52F0s-QXY6=
f%3Dcbw%40mail.gmail.com.

--001a11c022f001c410056504d601
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div dir=3D"auto">Is recursion a reasonable request in th=
e proposal too? I actually can&#39;t think of WHY one would want it, but it=
 might be worth a discussion for completeness.</div><div dir=3D"auto"><br><=
/div>Nicol, what are your thoughts on Florian&#39;s suggestion?<div dir=3D"=
auto"><br></div><div dir=3D"auto">In the interest of grounding ourselves (a=
lthough I&#39;m getting quite excited here), does anybody from the compiler=
 community have any input as to any stumbling blocks in the implementation =
of this?</div><br><div class=3D"gmail_extra" dir=3D"auto"><br><div class=3D=
"gmail_quote">On 12 Feb 2018 10:17,  &lt;<a href=3D"mailto:florian.csdt@gma=
il.com">florian.csdt@gmail.com</a>&gt; wrote:<br type=3D"attribution"><bloc=
kquote class=3D"quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr">Let me suggest something close to Nico=
l&#39;s solution, but not quite.<br><br>The F&quot;&quot; operator returns =
a special type that could be like a simple tuple (let&#39;s name it std::st=
ring_processing for now).<br><br>Then the user can use it directly into its=
 own functions.<br><br><br><div style=3D"background-color:rgb(250,250,250);=
border-color:rgb(187,187,187);border-style:solid;border-width:1px" class=3D=
"m_5802088551998586929prettyprint"><code class=3D"m_5802088551998586929pret=
typrint"><div class=3D"m_5802088551998586929subprettyprint"><span style=3D"=
color:#008" class=3D"m_5802088551998586929styled-by-prettify">auto</span><s=
pan style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">=
 column </span><span style=3D"color:#660" class=3D"m_5802088551998586929sty=
led-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_5802088551=
998586929styled-by-prettify"> </span><span style=3D"color:#080" class=3D"m_=
5802088551998586929styled-by-prettify">&quot;col&quot;</span><span style=3D=
"color:#000" class=3D"m_5802088551998586929styled-by-prettify">s</span><spa=
n style=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">;<=
/span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-pr=
ettify"><br></span><span style=3D"color:#008" class=3D"m_580208855199858692=
9styled-by-prettify">auto</span><span style=3D"color:#000" class=3D"m_58020=
88551998586929styled-by-prettify"> table </span><span style=3D"color:#660" =
class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span style=3D"=
color:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span=
 style=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify">&qu=
ot;tab&quot;</span><span style=3D"color:#000" class=3D"m_580208855199858692=
9styled-by-prettify">sv</span><span style=3D"color:#660" class=3D"m_5802088=
551998586929styled-by-prettify">;</span><span style=3D"color:#000" class=3D=
"m_5802088551998586929styled-by-prettify"><br></span><span style=3D"color:#=
008" class=3D"m_5802088551998586929styled-by-prettify">auto</span><span sty=
le=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> req </=
span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-pre=
ttify">=3D</span><span style=3D"color:#000" class=3D"m_5802088551998586929s=
tyled-by-prettify"> sql</span><span style=3D"color:#660" class=3D"m_5802088=
551998586929styled-by-prettify">(</span><span style=3D"color:#000" class=3D=
"m_5802088551998586929styled-by-prettify">F</span><span style=3D"color:#080=
" class=3D"m_5802088551998586929styled-by-prettify">&quot;select {column} f=
rom {table};&quot;</span><span style=3D"color:#660" class=3D"m_580208855199=
8586929styled-by-prettify">);</span><span style=3D"color:#000" class=3D"m_5=
802088551998586929styled-by-prettify"><br><br></span><span style=3D"color:#=
800" class=3D"m_5802088551998586929styled-by-prettify">// would be equivale=
nt to:</span><span style=3D"color:#000" class=3D"m_5802088551998586929style=
d-by-prettify"><br></span><span style=3D"color:#008" class=3D"m_58020885519=
98586929styled-by-prettify">auto</span><span style=3D"color:#000" class=3D"=
m_5802088551998586929styled-by-prettify"> req </span><span style=3D"color:#=
660" class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span styl=
e=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> sql</sp=
an><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-prett=
ify">(</span><span style=3D"color:#000" class=3D"m_5802088551998586929style=
d-by-prettify">std</span><span style=3D"color:#660" class=3D"m_580208855199=
8586929styled-by-prettify">::</span><span style=3D"color:#000" class=3D"m_5=
802088551998586929styled-by-prettify">string_processing</span><span style=
=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">&lt;</spa=
n><span style=3D"color:#008" class=3D"m_5802088551998586929styled-by-pretti=
fy">con<wbr>st</span><span style=3D"color:#000" class=3D"m_5802088551998586=
929styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_580208=
8551998586929styled-by-prettify">char</span><span style=3D"color:#660" clas=
s=3D"m_5802088551998586929styled-by-prettify">[</span><span style=3D"color:=
#066" class=3D"m_5802088551998586929styled-by-prettify">8</span><span style=
=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">]&amp;,</=
span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-pre=
ttify"> std</span><span style=3D"color:#660" class=3D"m_5802088551998586929=
styled-by-prettify">::</span><span style=3D"color:#008" class=3D"m_58020885=
51998586929styled-by-prettify">string</span><span style=3D"color:#660" clas=
s=3D"m_5802088551998586929styled-by-prettify">&amp;,</span><span style=3D"c=
olor:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span =
style=3D"color:#008" class=3D"m_5802088551998586929styled-by-prettify">cons=
t</span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-=
prettify"> </span><span style=3D"color:#008" class=3D"m_5802088551998586929=
styled-by-prettify">char</span><span style=3D"color:#660" class=3D"m_580208=
8551998586929styled-by-prettify">[</span><span style=3D"color:#066" class=
=3D"m_5802088551998586929styled-by-prettify">7</span><span style=3D"color:#=
660" class=3D"m_5802088551998586929styled-by-prettify">]&amp;,</span><span =
style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> std=
</span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-p=
rettify">::</span><span style=3D"color:#000" class=3D"m_5802088551998586929=
styled-by-prettify">string_view</span><span style=3D"color:#660" class=3D"m=
_5802088551998586929styled-by-prettify">&amp;,</span><span style=3D"color:#=
000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span style=
=3D"color:#008" class=3D"m_5802088551998586929styled-by-prettify">const</sp=
an><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prett=
ify"> </span><span style=3D"color:#008" class=3D"m_5802088551998586929style=
d-by-prettify">char</span><span style=3D"color:#660" class=3D"m_58020885519=
98586929styled-by-prettify">[</span><span style=3D"color:#066" class=3D"m_5=
802088551998586929styled-by-prettify">2</span><span style=3D"color:#660" cl=
ass=3D"m_5802088551998586929styled-by-prettify">]&amp;&gt;(</span><span sty=
le=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify">&quot;s=
elect &quot;</span><span style=3D"color:#660" class=3D"m_580208855199858692=
9styled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_58020885=
51998586929styled-by-prettify"> column</span><span style=3D"color:#660" cla=
ss=3D"m_5802088551998586929styled-by-prettify">,</span><span style=3D"color=
:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span styl=
e=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify">&quot; f=
rom &quot;</span><span style=3D"color:#660" class=3D"m_5802088551998586929s=
tyled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_5802088551=
998586929styled-by-prettify"> table</span><span style=3D"color:#660" class=
=3D"m_5802088551998586929styled-by-prettify">,</span><span style=3D"color:#=
000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span style=
=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify">&quot;;&q=
uot;</span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-=
by-prettify">));</span><span style=3D"color:#000" class=3D"m_58020885519985=
86929styled-by-prettify"><br></span></div></code></div><br>Now, if we want,=
 we could also support UDL (but not mandatory) by allowing to call UDL on t=
he std::string_processing:<br><br><div style=3D"background-color:rgb(250,25=
0,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px" c=
lass=3D"m_5802088551998586929prettyprint"><code class=3D"m_5802088551998586=
929prettyprint"><div class=3D"m_5802088551998586929subprettyprint"><span st=
yle=3D"color:#008" class=3D"m_5802088551998586929styled-by-prettify">auto</=
span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-pre=
ttify"> column </span><span style=3D"color:#660" class=3D"m_580208855199858=
6929styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_580=
2088551998586929styled-by-prettify"> </span><span style=3D"color:#080" clas=
s=3D"m_5802088551998586929styled-by-prettify">&quot;col&quot;</span><span s=
tyle=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">s</sp=
an><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-prett=
ify">;</span><span style=3D"color:#000" class=3D"m_5802088551998586929style=
d-by-prettify"><br></span><span style=3D"color:#008" class=3D"m_58020885519=
98586929styled-by-prettify">auto</span><span style=3D"color:#000" class=3D"=
m_5802088551998586929styled-by-prettify"> table </span><span style=3D"color=
:#660" class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span st=
yle=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> </spa=
n><span style=3D"color:#080" class=3D"m_5802088551998586929styled-by-pretti=
fy">&quot;tab&quot;</span><span style=3D"color:#000" class=3D"m_58020885519=
98586929styled-by-prettify">sv</span><span style=3D"color:#660" class=3D"m_=
5802088551998586929styled-by-prettify">;</span><span style=3D"color:#000" c=
lass=3D"m_5802088551998586929styled-by-prettify"><br></span><span style=3D"=
color:#008" class=3D"m_5802088551998586929styled-by-prettify">auto</span><s=
pan style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">=
 req </span><span style=3D"color:#660" class=3D"m_5802088551998586929styled=
-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_5802088551998=
586929styled-by-prettify"> F</span><span style=3D"color:#080" class=3D"m_58=
02088551998586929styled-by-prettify">&quot;select {column} from {table};&qu=
ot;</span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-b=
y-prettify">_sql</span><span style=3D"color:#660" class=3D"m_58020885519985=
86929styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_5802=
088551998586929styled-by-prettify"><br><br></span><span style=3D"color:#800=
" class=3D"m_5802088551998586929styled-by-prettify">// would be equivalent =
to:</span><span style=3D"color:#000" class=3D"m_5802088551998586929styled-b=
y-prettify"><br></span><span style=3D"color:#008" class=3D"m_58020885519985=
86929styled-by-prettify">auto</span><span style=3D"color:#000" class=3D"m_5=
802088551998586929styled-by-prettify"> req </span><span style=3D"color:#660=
" class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span style=
=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><=
span style=3D"color:#008" class=3D"m_5802088551998586929styled-by-prettify"=
>operator</span><span style=3D"color:#000" class=3D"m_5802088551998586929st=
yled-by-prettify"> </span><span style=3D"color:#080" class=3D"m_58020885519=
98586929styled-by-prettify">&quot;&quot;</span><span style=3D"color:#000" c=
lass=3D"m_5802088551998586929styled-by-prettify">_sql </span><span style=3D=
"color:#660" class=3D"m_5802088551998586929styled-by-prettify">(</span><spa=
n style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">st=
d</span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-=
prettify">::</span><span style=3D"color:#000" class=3D"m_580208855199858692=
9styled-by-prettify">string_processing</span><span style=3D"color:#660" cla=
ss=3D"m_5802088551998586929styled-by-prettify">&lt;</span><span style=3D"co=
lor:#008" class=3D"m_5802088551998586929styled-by-prettify">const</span><sp=
an style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> =
</span><span style=3D"color:#008" class=3D"m_5802088551998586929styled-by-p=
rettify">char</span><span style=3D"color:#660" class=3D"m_58020885519985869=
29styled-by-prettify">[</span><span style=3D"color:#066" class=3D"m_5802088=
551998586929styled-by-prettify">8</span><span style=3D"color:#660" class=3D=
"m_5802088551998586929styled-by-prettify">]&amp;,</span><span style=3D"colo=
r:#000" class=3D"m_5802088551998586929styled-by-prettify"> std</span><span =
style=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">::</=
span><span style=3D"color:#008" class=3D"m_5802088551998586929styled-by-pre=
ttify">string</span><span style=3D"color:#660" class=3D"m_58020885519985869=
29styled-by-prettify">&amp;,</span><span style=3D"color:#000" class=3D"m_58=
02088551998586929styled-by-prettify"> </span><span style=3D"color:#008" cla=
ss=3D"m_5802088551998586929styled-by-prettify">const</span><span style=3D"c=
olor:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><span =
style=3D"color:#008" class=3D"m_5802088551998586929styled-by-prettify">char=
</span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-p=
rettify">[</span><span style=3D"color:#066" class=3D"m_5802088551998586929s=
tyled-by-prettify">7</span><span style=3D"color:#660" class=3D"m_5802088551=
998586929styled-by-prettify">]&amp;,</span><span style=3D"color:#000" class=
=3D"m_5802088551998586929styled-by-prettify"> std</span><span style=3D"colo=
r:#660" class=3D"m_5802088551998586929styled-by-prettify">::</span><span st=
yle=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">string=
_view</span><span style=3D"color:#660" class=3D"m_5802088551998586929styled=
-by-prettify">&amp;,</span><span style=3D"color:#000" class=3D"m_5802088551=
998586929styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_=
5802088551998586929styled-by-prettify">const</span><span style=3D"color:#00=
0" class=3D"m_5802088551998586929styled-by-prettify"> </span><span style=3D=
"color:#008" class=3D"m_5802088551998586929styled-by-prettify">char</span><=
span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify"=
>[</span><span style=3D"color:#066" class=3D"m_5802088551998586929styled-by=
-prettify">2</span><span style=3D"color:#660" class=3D"m_580208855199858692=
9styled-by-prettify">]&amp;&gt;(</span><span style=3D"color:#080" class=3D"=
m_5802088551998586929styled-by-prettify">&quot;select &quot;</span><span st=
yle=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">,</spa=
n><span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-pretti=
fy"> column</span><span style=3D"color:#660" class=3D"m_5802088551998586929=
styled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_580208855=
1998586929styled-by-prettify"> </span><span style=3D"color:#080" class=3D"m=
_5802088551998586929styled-by-prettify">&quot; from &quot;</span><span styl=
e=3D"color:#660" class=3D"m_5802088551998586929styled-by-prettify">,</span>=
<span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify=
"> table</span><span style=3D"color:#660" class=3D"m_5802088551998586929sty=
led-by-prettify">,</span><span style=3D"color:#000" class=3D"m_580208855199=
8586929styled-by-prettify"> </span><span style=3D"color:#080" class=3D"m_58=
02088551998586929styled-by-prettify">&quot;;&quot;</span><span style=3D"col=
or:#660" class=3D"m_5802088551998586929styled-by-prettify">));</span><span =
style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"><br>=
</span></div></code></div><br>Now let&#39;s have some examples of it could =
be:<br><br>Simple string concatenation would be simple<br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px" class=3D"m_5802088551998586929prettyprint"><code cla=
ss=3D"m_5802088551998586929prettyprint"><div class=3D"m_5802088551998586929=
subprettyprint"><span style=3D"color:#008" class=3D"m_5802088551998586929st=
yled-by-prettify">auto</span><span style=3D"color:#000" class=3D"m_58020885=
51998586929styled-by-prettify"> concatenated </span><span style=3D"color:#6=
60" class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span style=
=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> F</span>=
<span style=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify=
">&quot;{str1}{str2}{str3}&quot;</span><span style=3D"color:#000" class=3D"=
m_5802088551998586929styled-by-prettify">s</span><span style=3D"color:#660"=
 class=3D"m_5802088551998586929styled-by-prettify">;</span><span style=3D"c=
olor:#000" class=3D"m_5802088551998586929styled-by-prettify"><br></span><sp=
an style=3D"color:#800" class=3D"m_5802088551998586929styled-by-prettify">/=
/ converted into an efficient concatenation of the 3 strings</span><span st=
yle=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"><br></=
span></div></code></div><br>We could print it into an iostream if we want (=
but would be here only for convenience on legacy code)<br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px" class=3D"m_5802088551998586929prettyprint"><code cla=
ss=3D"m_5802088551998586929prettyprint"><div class=3D"m_5802088551998586929=
subprettyprint"><span style=3D"color:#000" class=3D"m_5802088551998586929st=
yled-by-prettify">std</span><span style=3D"color:#660" class=3D"m_580208855=
1998586929styled-by-prettify">::</span><span style=3D"color:#000" class=3D"=
m_5802088551998586929styled-by-prettify">cout </span><span style=3D"color:#=
660" class=3D"m_5802088551998586929styled-by-prettify">&lt;&lt;</span><span=
 style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> F<=
/span><span style=3D"color:#080" class=3D"m_5802088551998586929styled-by-pr=
ettify">&quot;{str1}{str2}\n&quot;</span><span style=3D"color:#660" class=
=3D"m_5802088551998586929styled-by-prettify">;</span><span style=3D"color:#=
000" class=3D"m_5802088551998586929styled-by-prettify"><br></span><span sty=
le=3D"color:#800" class=3D"m_5802088551998586929styled-by-prettify">// equi=
valent to:</span><span style=3D"color:#000" class=3D"m_5802088551998586929s=
tyled-by-prettify"><br>std</span><span style=3D"color:#660" class=3D"m_5802=
088551998586929styled-by-prettify">::</span><span style=3D"color:#000" clas=
s=3D"m_5802088551998586929styled-by-prettify">cout </span><span style=3D"co=
lor:#660" class=3D"m_5802088551998586929styled-by-prettify">&lt;&lt;</span>=
<span style=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify=
"> str1 </span><span style=3D"color:#660" class=3D"m_5802088551998586929sty=
led-by-prettify">&lt;&lt;</span><span style=3D"color:#000" class=3D"m_58020=
88551998586929styled-by-prettify"> str2 </span><span style=3D"color:#660" c=
lass=3D"m_5802088551998586929styled-by-prettify">&lt;&lt;</span><span style=
=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> </span><=
span style=3D"color:#080" class=3D"m_5802088551998586929styled-by-prettify"=
>&quot;\n&quot;</span><span style=3D"color:#660" class=3D"m_580208855199858=
6929styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_58020=
88551998586929styled-by-prettify"><br></span></div></code></div><br>It coul=
d be implicitly convertible to a std::string (only if variables are implici=
tly convertible to std::string)<br><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px" =
class=3D"m_5802088551998586929prettyprint"><code class=3D"m_580208855199858=
6929prettyprint"><div class=3D"m_5802088551998586929subprettyprint"><span s=
tyle=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify">std</=
span><span style=3D"color:#660" class=3D"m_5802088551998586929styled-by-pre=
ttify">::</span><span style=3D"color:#008" class=3D"m_5802088551998586929st=
yled-by-prettify">string</span><span style=3D"color:#000" class=3D"m_580208=
8551998586929styled-by-prettify"> concatenated </span><span style=3D"color:=
#660" class=3D"m_5802088551998586929styled-by-prettify">=3D</span><span sty=
le=3D"color:#000" class=3D"m_5802088551998586929styled-by-prettify"> F</spa=
n><span style=3D"color:#080" class=3D"m_5802088551998586929styled-by-pretti=
fy">&quot;{str1}{str2}&quot;</span><span style=3D"color:#660" class=3D"m_58=
02088551998586929styled-by-prettify">;</span><span style=3D"color:#000" cla=
ss=3D"m_5802088551998586929styled-by-prettify"><br></span></div></code></di=
v><br>(No example with FMT as I don&#39;t know how it works, but I don&#39;=
t see any reason for it not to be compatible with FMT.)<br><br>And this wou=
ld be constexpr-able.<br><br>Now, formatting would require a bit more elabo=
rated type that could store formatting information.<br>But in the end, only=
 the user will know what to do with it.<br>However, I would prefer <b>not</=
b> to embed formatting in such a type, just to keep it simple. And use a li=
brary based solution when I really need formatting.<br><br>It has all the a=
dvantages of Nicol&#39;s solution, while being more versatile.<br><br>Flori=
an<div class=3D"elided-text"><br><br>Le dimanche 11 f=C3=A9vrier 2018 19:08=
:45 UTC+1, Nicol Bolas a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote"=
 style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div dir=3D"ltr">Your new idea is really no better than the old one.=
 The problem comes back to the same point: you are conflating two fundament=
ally distinct operations: the operation to be applied to each string fragme=
nt, and the operation to be applied to aggregate the fragments into a whole=
..<br><br>Your first idea involved the use of two UDL overloads, thereby tig=
htly coupling the two operations. Your second idea only uses one UDL overlo=
ad, but it still tightly couples the two operations by forcing all string f=
ragments to use the &quot;same type&quot;. Or more specifically, to use the=
 same string fragment processed template: `std::string_literal`.<br><br>In =
99% of cases, you don&#39;t need to do character-by-character analysis of s=
uch literals. A simple array of characters will do. This is why the UDL def=
inition syntax doesn&#39;t <i>force</i> you to process all literals by char=
acters of a template parameter. It certainly gives you that option, but it =
is not forced on you.<br><br>There is no reason why string interpolation sh=
ould force this upon you. With my way, you can <i>choose</i> to process the=
 fragments this way:<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:#008">template</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">char=
</span><span style=3D"color:#660">...</span><span style=3D"color:#000"> cha=
rs</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><=
br></span><span style=3D"color:#008">auto</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">operator</span><span style=3D"color:#000=
"> </span><span style=3D"color:#080">&quot;&quot;</span><span style=3D"colo=
r:#000">literal</span><span style=3D"color:#660">()</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#=
008">return</span><span style=3D"color:#000"> std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#000">string_literal</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#000">chars</span><span st=
yle=3D"color:#660">...&gt;{<wbr>};}</span><span style=3D"color:#000"><br><b=
r>std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">=
do_something</span><span style=3D"color:#660">(</span><span style=3D"color:=
#000">F</span><span style=3D"color:#080">&quot;some string {variable}&quot;=
</span><span style=3D"color:#000">literal</span><span style=3D"color:#660">=
);</span></div></code></div><br>But you aren&#39;t <i>required</i> to. You =
can choose how you want to process those fragments. The 99% of cases that w=
ork just fine with `const char*`s or whatever=20
don&#39;t have to deal with this `std::string_literal` type. The 1% of temp=
late=20
metaprogramming heavy cases have this available as an option.<br><br>Except=
ional circumstances should be optional, not the default.<br><br>I do not un=
derstand your fervent insistence on using UDLs to provide the aggregation f=
unction to be called, rather than explicitly calling an actual function. It=
 doesn&#39;t even make sense conceptually.<br><br>On a conceptual level, a =
UDL operation produces an object. But not all aggregation operations on an =
interpolated string will produce an &quot;object&quot;; I see no reason why=
 I can&#39;t do this:<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">std</span><span style=3D"color:#660">::</sp=
an><span style=3D"color:#000">output</span><span style=3D"color:#660">(</sp=
an><span style=3D"color:#000">std</span><span style=3D"color:#660">::</span=
><span style=3D"color:#000">cout</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> F</span><span style=3D"color:#080">&quot;some st=
ring {variable}&quot;</span><span style=3D"color:#660">);</span></div></cod=
e></div><br>This just writes the individual members of the interpolated str=
ing to the given output stream. No object is being generated; I&#39;m simpl=
y invoking a process.<br><br>Something similar goes for your SQL database o=
peration:<br><br><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span s=
tyle=3D"color:#000">db</span><span style=3D"color:#660">.</span><span style=
=3D"color:#008">exec</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">F</span><span style=3D"color:#080">&quot;some sql stuff {va=
r1} more sql {var2};&quot;</span><span style=3D"color:#660">);</span></div>=
</code></div><br>No object needs to be created; you&#39;re just running a c=
ommand.<br><br>Using UDLs to invoke the aggregation operation is just the w=
rong concept.<br><br>On Sunday, February 11, 2018 at 9:20:28 AM UTC-5, Marc=
in Jaczewski wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>On Sunday, February 11, 2018 at 9:35:50 AM UTC+1, Nicol Bolas wrote:<block=
quote 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 Saturday, February 10=
, 2018 at 9:38:20 PM UTC-5, Marcin Jaczewski wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr"><div>And then wat result will be of:<br><d=
iv 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"=
>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">&=
quot;A {42} B&quot;</span><span style=3D"color:#000">_z</span><span style=
=3D"color:#660">;</span></div></code></div><br>If it work as pack expansion=
 then it do not have meaning on its own.<br></div></div></blockquote><div><=
br>You say that like it&#39;s a bad thing. Does `pack...` have meaning on i=
ts own?<br><br></div></div></blockquote><div><br>You can use pack expansion=
 only in specific places:<br></div></div></blockquote><div><br>I know that.=
 My point was that we already have grammatical constructs like that which o=
nly work in a limited number of places. What is wrong with making string in=
terpolation work that way?<br><br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr"><div>The point of my idea is that it provides a sharp separa=
tion between the two fundamental operations of &quot;string interpolation&q=
uot;. There&#39;s the &quot;convert a string literal into a bunch of smalle=
r literals and variables&quot; part. And there&#39;s the &quot;do something=
 with that bunch of smaller literals and variables.&quot;<br><br>By making =
part 1 into a pack expansion-like construct, it forces you to make the way =
you want to process that expansion <i>explicit</i>. It also makes a clear d=
istinction between a UDL used for normal purposes and the system used to pr=
ocess code.<br><br></div></div></blockquote><div>=C2=A0<br>But this work in=
 this way in C# and JavaScript (and probably other languages too), C# retur=
n final string (or interface that you can tweak result a bit) and JS return=
 fully processed object from tag function.<br>My approach mimic it.<br></di=
v></div></blockquote><div dir=3D"ltr"><br>C++ has many language features th=
at do similar things from other languages but in different ways. Lambdas ar=
e pretty unique in C++, as are the way we handle variadic parameters and ex=
pansion (most languages make you index the variadic list; we allow you to w=
rite patterns and expand them in-situ). Indeed, every language has its own =
specific quirks and distinctions. I see no reason to exactly mimic other la=
nguages when we can make the mechanism so much more flexible than what you&=
#39;re proposing.<br><br>Not unless it actually gains us something. <br><br=
></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>You ca=
n&#39;t change return type based on `char*` value (this was what Marcel use=
d in his version), this would require `constexpr` arguments that probably w=
ill be never added to language.<br></div></div></blockquote><div><br>`const=
expr` programming is not based on a 1:1 mapping between &quot;type&quot; an=
d &quot;value&quot;; it&#39;s based on regular C++ programming principles. =
On using different <i>values</i> for those types; we&#39;re just doing it a=
t compile time instead of runtime. That&#39;s why its much better than tryi=
ng to use template metaprogramming.<br><br>In short, you don&#39;t <i>need<=
/i> it to work this way. Once we can actually create and manipulate strings=
 at compile time, there&#39;s little point to using metaprogramming to proc=
ess them.</div><br></div></blockquote></div></div><div class=3D"elided-text=
">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/750ecf62-9637-40f4-8585-e3be2780fb46%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/750e=
cf62-9637-40f4-<wbr>8585-e3be2780fb46%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></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%2B0CCOV7Qf21J-MBpdggkkrNt8Hs2dN03=
o52F0s-QXY6f%3Dcbw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCOV7Q=
f21J-MBpdggkkrNt8Hs2dN03o52F0s-QXY6f%3Dcbw%40mail.gmail.com</a>.<br />

--001a11c022f001c410056504d601--

.
