220 36911 <CAC+0CCPrAspxkZJXbhJyc9UCXS3FAw3UU0GEvAzURwKG1-pvoA@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: Wed, 14 Feb 2018 01:25:49 +0000
Lines: 808
Approved: news@gmane.org
Message-ID: <CAC+0CCPrAspxkZJXbhJyc9UCXS3FAw3UU0GEvAzURwKG1-pvoA@mail.gmail.com>
References: <356d5835-f1bf-4699-94f5-0b2d3d0b9c0e@isocpp.org>
 <CAMD6iD9aT26x8GQHnQL+kuj3Rq8fVQSfYYFtvTnFidkf6jU_ag@mail.gmail.com>
 <25CCF885-86AD-4D51-8F5C-C46376D34DE0@gmail.com> <4890431.TR9UepuQra@tjmaciei-mobl1>
 <CALvx3hac77b6Z=EOWzKqynALi1-352OvY0dnnOer8rN6tfa01g@mail.gmail.com>
 <1cdb6300-7397-46d7-bce9-62e6e8dac40b@isocpp.org> <CAC+0CCOSZHaTA=YPSDU8Add7mE_BYcYPRCmGW8TRPtZhdqL8Hw@mail.gmail.com>
 <4bce681e-e729-4124-9322-69291fdb6678@isocpp.org> <f5feb9a0-99d3-433a-ae46-af34c8d00a61@isocpp.org>
 <8e456af5-09c3-461d-8562-30df127e93af@isocpp.org> <bd24b702-025a-4b06-976b-559c779851e1@isocpp.org>
 <f63ed807-c5f6-4997-b03f-b4bc16a70982@isocpp.org> <28e80709-5ebb-44d2-b26d-22cafd681330@isocpp.org>
 <52b86f0a-b3b9-455f-9d4d-0f6b15192c90@isocpp.org> <1e9a5468-6efa-48a2-87ce-6bdb6d5c4e83@isocpp.org>
 <750ecf62-9637-40f4-8585-e3be2780fb46@isocpp.org> <f8f4407b-ecf6-4a4a-b3f6-c65813e3f843@isocpp.org>
 <5b5435db-772e-4c38-8867-f6fbc66d7cec@isocpp.org> <5c51d89a-54b6-490b-87f2-09ed263d8322@isocpp.org>
 <305b7669-0744-473e-9715-807b7e8051b6@isocpp.org> <0ceb2063-d7b6-4cb8-8c5c-c63aceb5b549@isocpp.org>
 <d26b85c2-707b-49a5-a007-617027506dd1@isocpp.org> <41b87b07-1a91-4bca-ba00-5734c09dbe77@isocpp.org>
 <ef8fbc4c-08c0-409e-815b-28e161101231@isocpp.org> <1a7f714d-4a91-4a95-8da4-0c688d18c4c4@isocpp.org>
 <5f8efcc0-f4e9-4518-abe5-5fffeab55083@isocpp.org> <0e0876bb-7a44-45ff-ab9b-6443e78ea59c@isocpp.org>
 <3468ee0c-a44a-437a-a835-0156c623df2e@isocpp.org> <d2698aec-cf41-4787-8aa5-334a34868aea@isocpp.org>
 <589a55c8-d886-4bb1-b991-96c5e9fe910a@isocpp.org> <c753942d-be11-4cc0-bde1-7f71b6184367@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="94eb2c04f868cc4418056521fdc6"
X-Trace: blaine.gmane.org 1518571485 595 195.159.176.226 (14 Feb 2018 01:24:45 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 14 Feb 2018 01:24:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDCZX3WUUQFRBH5AR3KAKGQESAPZMTY@isocpp.org Wed Feb 14 02:24:40 2018
Return-path: <std-proposals+bncBDCZX3WUUQFRBH5AR3KAKGQESAPZMTY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f72.google.com ([209.85.218.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDCZX3WUUQFRBH5AR3KAKGQESAPZMTY@isocpp.org>)
	id 1elloC-0007Zr-NA
	for gclcip-std-proposals@m.gmane.org; Wed, 14 Feb 2018 02:24:29 +0100
Original-Received: by mail-oi0-f72.google.com with SMTP id d135sf10204887oib.15
        for <gclcip-std-proposals@m.gmane.org>; Tue, 13 Feb 2018 17:26:34 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1518571594; cv=pass;
        d=google.com; s=arc-20160816;
        b=T+/083Dy6wP+JrY8BDlKw7KwYGqA+Yx2CEc+6xlSAQbEKXuu1TcnZfNTmKUpsFzmxR
         dsaOrq2Weld2C1Dswltg6KPVjpV4XxbXFHuEi0EUP3jnrlXC69xLCtL4AGT9byd+t88/
         n6z5EuHwXc3p/PJjw7Zg+E617ZEu2phIGsNBmoejYwDGRHzAmtgnyq0UR4OGgnDZPhBW
         VvP/GGE8mVKzRUUyoBTVPNUA52BwTfJigHNBYS83owdaoVSq9NIvdB7C9DPKIafaFC3D
         w375cCgvqSp6NdTf4fuMgBdgQVmzqw5oDyKnsaktjQ9GHl7qV4Fo9dIgp2DYCvepEn9U
         F9ZQ==
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=Y4L0xcRlF7JeoOGB525gCWL7eg8g4pX+omH0ENOzhig=;
        b=wKTk01gznNGtoXUK/CEBEwOUiF2fDgxfHUYNLlkNDZfupiS/1QrnI1ZNHb5LgBySJ6
         t7XQu7l19JmreXQ64tIihDXJWQlKEFgXU4q3ZHB5lXXw3KQmEb91GF2QZUZakWXeQVOV
         cp4qIJC216F0fpYNnFVsDa1ixeLqditrdIkRpJsPL05xR0a2RM7rkNyyNc5qKYoB4wCS
         dnXLdg5qKpQlNfsAympUDAKskj5weLZ3RbsCgO+MG/geADXsT9O5h0C5ZbhWbssLfvri
         qx0OI9UNRUx/pJmf2VHYQcqCpYlbpTjm0u7itV+tR5PGmq7JgZije1WQtrVhPo/tBU87
         dfbQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y45OyJkJ;
       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=Y4L0xcRlF7JeoOGB525gCWL7eg8g4pX+omH0ENOzhig=;
        b=CjnaYfsrr54cKcDPERcBo6kb2KQQckAGCPCA5QbfKkIEAZf1n8tmnoAZMACagT+hMA
         lg3dnJ+Ilr+zGkBOKEpZUbqTamp+iTBbMNNnIXvBOAd1WiSQIl3bQeq2rNu1hjvexa2J
         4zQOMDgJMAAcLSn1gHVaDrrPz2RbuCGIQE2jBUnS6iXeFQpV7JNN8JlBbURf8mFLkEu5
         tovm+Whkx3ZUzZtpw2ysqW3BzBOc7VRbC5Hwt7AHxtKtM2gxavXwnrldIXdKW5GTSwWw
         Eq40A2dY6M/g+inpFBrmUU0QN3qHFskBbf391QSw5xamUCdsCW2t1zF8/efNutKhDewo
         2fIQ==
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=Y4L0xcRlF7JeoOGB525gCWL7eg8g4pX+omH0ENOzhig=;
        b=MVyKYODcXbdG1nljIYa0b28YOx3XggUKb+D/jp7esfXPv9pobqjxVg7YP2X36MekUs
         6G4uKvmbK1iLqzuzeaWf5yexDy5FLbnvtRITm9m0Hl9rP96DaUumFyLFu8gEhN90Vi6y
         3xPycs1aTsciTQAt7D81xtOxeqOR4oYvE0adK0iNsfrgbcU5e2Kc2KKDjglbhMmLQT5Y
         kDZNXKgrOaGcBWODLm08QL5vljNpSchh4QQOQUmYQnSY9qSdHJQwH5CCgswqja8KUX90
         IPdVF4DjkbI30lViETsv0/VcIwvLechsNYPwtLjkJmIbc/I6yMNRl4EQNUN34uGQBpG0
         NA3g==
X-Gm-Message-State: APf1xPAjDl+0n1BCL4i6fLb9UC1TXlO8IDNxj8ABYk8pN3lR0AA/3hu9
	PWVDa/PJGduYaXTmiqSgLIp9MA==
X-Google-Smtp-Source: AH8x224I2jGi02YQ6Ghbr8KIHcBGIPbR9wTDuqm5ihWTmISzjVcp21BthvOEb4QcsmL5bVZX3DYQKw==
X-Received: by 10.202.18.17 with SMTP id 17mr1554006ois.48.1518571594325;
        Tue, 13 Feb 2018 17:26:34 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.84.78.148 with SMTP id c20ls841143oiy.12.gmail; Tue, 13 Feb
 2018 17:25:50 -0800 (PST)
X-Received: by 10.202.178.5 with SMTP id b5mr2194849oif.152.1518571550606;
        Tue, 13 Feb 2018 17:25:50 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1518571550; cv=none;
        d=google.com; s=arc-20160816;
        b=KdLKT1Dsd36EJ+SwO3VcbiaXHyRX5Fo3GvObPuZkkKKGG8eJEvsFcg/LxkbiVHBkOn
         aIS4uR1vP3df6NCJ78KBTXp6CnClEqQ9j+1kt2kf+IGfSe5zcmf+loIOF7RuC1xO2PF/
         KEq9bfpgQhpcIlEuvfKIPNfYoDT4C+8GDkT/+wRaWFyMqej+VeDDzSPgLNeUcbJKkcY9
         onGg+Vi6J9Z4oiofwMK4WvMOdVWVXGoapS4xhAQPIgeXQo456IGZdXZSooOVdNva8Jnu
         sShwBJZDZML5kYSDoi0lVTPGVRlLNekiVU6wU1/T6+ZmR41LQTfBYRaPccbrBiwnqOjq
         iG+A==
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=aUppi0OP1BdVn8g0fJ84RMJe0S8maAjXOxw2cnhcfsw=;
        b=uZn5kuVaVdKhLERDfpCdgK45cF81TiR/Y5UkzA84KteSoSFPCCN05bt9q6i2vrk9E/
         BHURCfk3QOPdsi+B3YvKkkNJTxeVTt+ckSRVf1EKJUMSbayTc6gyI/SVlUE+mQnTaAzJ
         a6TFAld1iN0a67qI+8u1dtwe/86QI3RZa/31eQdU0//DCTFVZGHc58DGFEHc/y36txJM
         cYmD0nsEk3waEY4KbIQ9zN4PDWDJJHCxvG8jevo7SdHDu7Xv2sWCGNvxP3T5gw1B9rbo
         ZcLyUBzbqc6K4OHZIv956HxQdWQdQfs3CbqXky4XJWOeDy1tSkeCR35+Eiv3Qz1A2d0W
         KrhQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y45OyJkJ;
       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 44sor4891257ote.74.2018.02.13.17.25.50
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Tue, 13 Feb 2018 17:25:50 -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.6.194 with SMTP id 60mr781735otx.288.1518571549900; Tue,
 13 Feb 2018 17:25:49 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Tue, 13 Feb 2018 17:25:49 -0800 (PST)
Original-Received: by 10.168.151.129 with HTTP; Tue, 13 Feb 2018 17:25:49 -0800 (PST)
In-Reply-To: <c753942d-be11-4cc0-bde1-7f71b6184367@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=Y45OyJkJ;       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:36911
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36911>

--94eb2c04f868cc4418056521fdc6
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I certainly see some benefit of string literals separating parameters for
ease, but at the same time I can imagine that there will be some situations
where meaningless empty strings complicate matters. It has the potential to
be a quirk, rather than a feature. Parsing the parameters in a one by one
manner could be a pain; I guess it would involve splitting the handling
into two functions - one for literals, one for variables, and each
recursively calls the other with the next parameter iff it exists.

The alternative is a monad approach. Wrap the literal values in some
template literal_string<> and the injected variables in some template
injected_variable<T>, or just one of the two (I guess the latter makes more
sense). That could get ugly real quick, but it helps distinguish the two.
At least then one could use template specialisation to handle the
situations differently, without needing to rely on a fixed every-other
structure.



On 14 Feb 2018 01:03, "Todd Fleming" <tbfleming@gmail.com> wrote:

> On Tuesday, February 13, 2018 at 6:55:47 PM UTC-5, Marcin Jaczewski wrote=
:
>>
>>
>>
>> On Tuesday, February 13, 2018 at 10:39:35 PM UTC+1, Nicol Bolas wrote:
>>>
>>> On Tuesday, February 13, 2018 at 12:18:59 PM UTC-5, floria...@gmail.com
>>> wrote:
>>>>
>>>> Le mardi 13 f=C3=A9vrier 2018 17:35:49 UTC+1, Nicol Bolas a =C3=A9crit=
 :
>>>>>
>>>>> Because it would never be called. Basically, what you'd need is this
>>>>> constructor:
>>>>>
>>>>> template<size_t N>
>>>>> string_view(const char s[N]);
>>>>>
>>>>> But you already have this constructor:
>>>>>
>>>>> string_view(const char *s);
>>>>>
>>>>> An array decays into a pointer. And since the pointer constructor is
>>>>> not a template, it is considered a better match than the array versio=
n. And
>>>>> therefore, any ltieral you pass will go through the pointer version r=
ather
>>>>> than the array template.
>>>>>
>>>>> And it should be noted that this has nothing to do with being a
>>>>> literal. If you used a `const char[]` variable, it *still* would
>>>>> prefer the pointer version due to array->pointer conversion. So this =
is not
>>>>> a case of "string literals are broken now".
>>>>>
>>>>
>>>> How can you say that preferring a lossy conversion over a lossless one
>>>> is not broken? (Here, we lose the length information)
>>>>
>>>
>>> Because the "lossy conversion" part being preferred has nothing to do
>>> with them being string literals. The lossy conversion is not the
>>> literal-to-array conversion; it's the array-to-pointer conversion.
>>>
>>> You're complaining about the wrong problem.
>>>
>>> This make it impossible to work with string literal because they simply
>>>> don't exist in the language. This is why I said string literals are br=
oken.
>>>>
>>>>
>>>>> But there's no "fix" for this, since any array->pointer "fix" would b=
e
>>>>> both wildly incompatible with C and break tons and tons of code. So y=
ou can
>>>>> either accept the language and work with what we have, or rail agains=
t it.
>>>>>
>>>>
>>>> Ok it's not possible to fix array decay because of backward
>>>> compatibility, but it is still possible to fix string literals if we m=
ake
>>>> them something that is not an array.
>>>>
>>>
>>> Why would changing the behavior of string literals be any more backward=
s
>>> compatible than changing the behavior of arrays? There's lots of code o=
ut
>>> there that works with C++'s string literal rules. Can you find a way to
>>> change those rules without breaking their code?
>>>
>>> Let me give you a simple case: `decltype("a string literal")` is an
>>> array type. Therefore, any BC change will have to leave it as an array
>>> type. So what rules would you change to fix the problem you want fixed
>>> without changing the result of that `decltype`?
>>>
>>> So I rail against those defects in order to be heard, and maybe, at som=
e
>>>> point, they will be fixed.
>>>>
>>>
>>> Yeah, that's not how this works. You can "rail against those defects"
>>> all you like, but unless you're willing to actually work on it (ie: fin=
ding
>>> a solution that doesn't break the world and getting it through the
>>> committee), it will not get fixed. Or you manage to convince someone wh=
o's
>>> actually willing to put in said work to do so.
>>>
>>> If this is not the place to speak out loud about those defects, then
>>>> where should we go?
>>>>
>>>> But don't get me wrong, when I code, I work with what I have, and I
>>>> accept the language as it is.
>>>>
>>>>
>>>>>
>>>>> It's funny how the more I dig in C++, the more bulky it appears to be
>>>>>> just because of these very small annoyances.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> It's a 3 step process; let's not interfere in that.
>>>>>>>
>>>>>>>
>>>>>>>> We could have exatcly the situation with string interpolation:
>>>>>>>> auto s =3D std::concat(F"{str1}{str2}{str3}");
>>>>>>>> // would be equivalent to
>>>>>>>> auto s =3D F"{str1}{str2}{str3}"s;
>>>>>>>>
>>>>>>>> I don't see why allowing UDL to work like that would decrease
>>>>>>>> usability as we could always use regular functions.
>>>>>>>>
>>>>>>>
>>>>>>> Because you can't do this:
>>>>>>>
>>>>>>> std::concat(F"some string {variable} other string"sv);
>>>>>>>
>>>>>>> Under my system, the UDL employed here allows you to decide how to
>>>>>>> process each of the literal fragments. The UDL applies to the parts=
 of the
>>>>>>> literal that are actually strings. So `concat` would get `string_vi=
ew`s,
>>>>>>> rather than `const char[X]` parameters.
>>>>>>>
>>>>>>> Under your system, the processing of the literal fragments is
>>>>>>> controlled entirely by the system that computes the aggregation.
>>>>>>>
>>>>>>
>>>>>> Let's sum up, string literals are broken today. So we should probabl=
y
>>>>>> try to solve this big issue before trying to see how we can cripple
>>>>>> string_interpolation in order to fit in current-ish C++.
>>>>>>
>>>>>
>>>>> I fail to see why applying a UDL to the literal fragments rather than
>>>>> the interpolation aggregation operation should be considered "crippli=
ng"
>>>>> string interpolation.
>>>>>
>>>>> Whatever breakage you see in literals isn't standing in the way of
>>>>> string interpolation. It's just standing in the way of string interpo=
lation
>>>>> working the way *you* want it to.
>>>>>
>>>>
>>>> Because string interpolation is dealing with string literals,
>>>>
>>>
>>> Why does it have to be? If constexpr strings are in the future, it'd be
>>> really nice if string interpolation were defined in such a way that it
>>> could be used on them. Tying interpolation to literals is not
>>> forward-thinking.
>>>
>>> if those literals are broken (and they are), how can we have a proper
>>>> string interpolation?
>>>>
>>>
>>> Because any "brokenness" of string literals has no effect on our abilit=
y
>>> to use string interpolation. If you want sized strings for those string
>>> fragments, that's what the `sv` suffix is for.
>>>
>>> Literal issues only are a problem for string interpolation because you
>>> believe that the suffix ought to be able to define the aggregation
>>> operation. If you stop believing that, then all of a sudden, your probl=
em
>>> with string literals becomes a non-issue for interpolation.
>>>
>>> It should also be noted that this:
>>>
>>> template<typename T>
>>> void foo(const T& t);
>>>
>>> foo("an array");
>>>
>>> The call to `foo` will deduce `T` to be `char[9]`. So a variadic
>>> template function that takes the results of string interpolation will g=
et
>>> sized array types, not pointers.
>>>
>>> Note that this doesn't invalidate anything I said. The point of doing
>>> `F"blah {variable} blah"sv` is not necessarily because you need them to
>>> keep the size around. Using `string_view` has many other advantages, wi=
th
>>> its member functions, `operator<<` overloads, and the like. So wanting =
to
>>> apply `sv` to each of the fragments is a perfectly reasonable operation=
..
>>>
>>> Also, `string_view` is a lot more convenient to use than an array of
>>> characters.
>>>
>>> You said:
>>>>
>>>>> The point of that discussion was a comment someone made about doing
>>>>> template metaprogramming on string literals. To do that, you need a w=
ay to
>>>>> access each literal as a distinct type, some `string_literal<char, 'c=
',
>>>>> 'h', 'a', 'r'>` type. And only a UDL applied to each fragment can per=
form
>>>>> that kind of synthesis.
>>>>>
>>>>
>>>> UDL is the only way to do it only because string literals are broken.
>>>> If we had proper string literals, it should be possible to do it simpl=
y
>>>> with regular functions.
>>>>
>>>
>>> No, it would not. Even if a string literal had a non-array type with a
>>> stored size, each literal value would still not have its own distinct
>>> *type*. Even if the size is a template argument, two literals can store
>>> different characters while still having the same size. And you cannot d=
o
>>> type-based metaprogramming without having a 1:1 mapping between value a=
nd
>>> type.
>>>
>>> Remember: while UDL's *can* take strings as a sequence of character
>>> template parameters, there's a good reason why they aren't *required*
>>> to do so. We don't want to force that onto everybody, and a non-"broken=
"
>>> string literal system would not force that on people.
>>>
>>> So even with your approach, broken string literals are a problem for
>>>> string interpolation. Just not at the same place.
>>>>
>>>> I'm not sure if my approach is the right one (it's probably not), but
>>>> most of your arguments stand only because string literal are broken
>>>> (otherwise, it would have been simple to do the same with my approach =
too).
>>>>
>>>> My point is: yes your approach makes it easier with current C++, but w=
e
>>>> shouldn't go for something that works quite well with current C++, but
>>>> something that will work very well with future C++.
>>>> That's why I think it's better to first fix string literals. And then
>>>> have string interpolation right the first time.
>>>>
>>>> And btw, if string literals are fixed, string interpolation could be
>>>> made a library solution only ( with a different but reasonable syntax)=
..
>>>>
>>>
>>> It's impossible to do that. String interpolation, at its core, is about
>>> taking the contents of a string and applying them in some way to the co=
de
>>> *around* that string. A library solution cannot possibly do that.
>>>
>>> Oh sure, a `constexpr` function could do the parsing. But then what? I'=
m
>>> fairly certain that no static reflection proposal provides a mechanism =
to
>>> turn a string into a reference to a local variable. And even if they di=
d,
>>> the location where you're doing that conversion wouldn't have that vari=
able
>>> in scope (since it's in a function call), so it couldn't possibly work.
>>>
>>> PS: I think it would be preferable to stop the discussion here, as it
>>>> becomes more and more off-topic.
>>>>
>>>
>>> But what if we don't agree that string interpolation needs better
>>> literals?
>>>
>>> Your premise is essentially that my suggested syntax is some kind of
>>> compromise, that if literals weren't "broken" the way you feel that the=
y
>>> are, then it would *clearly* be correct to have UDLs applied to
>>> aggregation rather than to the individual fragments.
>>>
>>> I don't agree with that premise. Whether literals are good or broken is
>>> a side issue. Even if we had perfect literals, I would *still* rather
>>> UDLs be focused on individual string literal manipulation rather than
>>> string interpolation aggregation.
>>>
>>
>>
>> After some toughs I come to conclusion that mixing interpolation with UD=
L
>> is limiting thing and this is good thing. Why? Because beside good thing=
s
>> it limit bad things too.
>> I start from high metaprograming starting point where I made all trader
>> offs to make it work, you start from basic usage and use opposite option=
s.
>> As consequence all my example of use of string interpolation become
>> unusable in your approach.
>>
>> We can start with sql, you suggest that version:
>> db.exec(F"some sql stuff {var1} more sql {var2};");
>>
>> I can quote someone: "Have we learned nothing from Little Bobby Tables?"=
,
>> how you want disquisition between `const char*`s parameters?
>> I did not had this problem because I can limit how parameters are pass t=
o
>> UDL and I can relay on it.
>> One way to avoid it is add new literal that will help with that but in
>> some corner cases it could still break.
>>
>> db.exec("select sth"_sql);
>> db.exec(F"select sth when {name}"_sqlp); //as you point outs, "select x"
>> is not sql, we need diffrent postfix.
>> tuple(F"{name1}{name2}"); //this is `tuple<const char*, const char*>` or
>> `tuple<const char*, const char*, const char*, const char*, const char*>`=
?
>> tuple(F"{name1} {name2}"); //same type as above?
>> translate(F"With {part} to {change}? Can I {change}{order} in any way?",
>> "fr"); //BTW "fr" is part of interpolated string from perspective of
>> this function
>> In my case all this things can be enclosed in UDL and will not leak
>> outside.
>>
>> Another problem is that even if your version is more flexible you still
>> repeat in multiple of place usage of specialization point functions
>> otherwise you cant use interpolation without it, in my version you only
>> would need use them in UDL.
>>
>> Probably without lot of limitation, many quirks will prevent any serous
>> metaprograming. I'm inclined to thinking that whole idea will not go far=
..
>>
>> btw
>> f(F"T{{a}}"); //is `f("T{{a}}")` or `f("T", {a})`?
>> Where both version could compile. Probably safer would be follow JS
>> version where we it use `${` to start interpolation.
>>
>>
> This could stop Little Bobby Tables:
>
> f(F"{a}{b}");
>
> could translate to
>
> f("", a, "", b, "");
>
>
> arguments 0, ..., 2n are always literals and 1, ..., 2n-1 are always
> expressions.
>
> f(F"T{{a}}");
>
> would be
>
> f("", {a}, "")
>
>
> --
> 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/c753942d-be11-4cc0-
> bde1-7f71b6184367%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c753942d-be=
11-4cc0-bde1-7f71b6184367%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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%2B0CCPrAspxkZJXbhJyc9UCXS3FAw3UU0GEvAzURwKG1=
-pvoA%40mail.gmail.com.

--94eb2c04f868cc4418056521fdc6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">I certainly see some benefit of string literals separatin=
g parameters for ease, but at the same time I can imagine that there will b=
e some situations where meaningless empty strings complicate matters. It ha=
s the potential to be a quirk, rather than a feature. Parsing the parameter=
s in a one by one manner could be a pain; I guess it would involve splittin=
g the handling into two functions - one for literals, one for variables, an=
d each recursively calls the other with the next parameter iff it exists.<d=
iv dir=3D"auto"><br></div><div dir=3D"auto">The alternative is a monad appr=
oach. Wrap the literal values in some template literal_string&lt;&gt; and t=
he injected variables in some template injected_variable&lt;T&gt;, or just =
one of the two (I guess the latter makes more sense). That could get ugly r=
eal quick, but it helps distinguish the two. At least then one could use te=
mplate specialisation to handle the situations differently, without needing=
 to rely on a fixed every-other structure.</div><div dir=3D"auto"><br></div=
><div dir=3D"auto"><br></div></div><div class=3D"gmail_extra"><br><div clas=
s=3D"gmail_quote">On 14 Feb 2018 01:03, &quot;Todd Fleming&quot; &lt;<a hre=
f=3D"mailto:tbfleming@gmail.com">tbfleming@gmail.com</a>&gt; wrote:<br type=
=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Tuesday=
, February 13, 2018 at 6:55:47 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 Tuesday, February =
13, 2018 at 10:39:35 PM UTC+1, Nicol Bolas wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr">On Tuesday, February 13, 2018 at 12:18:59 PM=
 UTC-5, <a>floria...@gmail.com</a> 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">Le mardi 13 f=C3=A9vrier 2018 17:35:49 UTC+1, Nicol =
Bolas a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin:=
0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div>Because it would never be called. Basically, what you&#39;d n=
eed is this constructor:<br><br><div style=3D"background-color:rgb(250,250,=
250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><co=
de><div><span style=3D"color:#008">template</span><span style=3D"color:#660=
">&lt;</span><span style=3D"color:#000">size_t N</span><span style=3D"color=
:#660">&gt;</span><span style=3D"color:#000"><br>string_view</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#008">const</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">char</span><span style=
=3D"color:#000"> s</span><span style=3D"color:#660">[</span><span style=3D"=
color:#000">N</span><span style=3D"color:#660">]);</span></div></code></div=
><br>But you already have this constructor:<br><br><div style=3D"background=
-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bo=
rder-width:1px"><code><div><span style=3D"color:#000">string_view</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#008">const</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">char</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">*</span><span style=
=3D"color:#000">s</span><span style=3D"color:#660">);</span></div></code></=
div><br>An array decays into a pointer. And since the pointer constructor i=
s not a template, it is considered a better match than the array version. A=
nd therefore, any ltieral you pass will go through the pointer version rath=
er than the array template.<br><br>And it should be noted that this has not=
hing to do with being a literal. If you used a `const char[]` variable, it =
<i>still</i> would prefer the pointer version due to array-&gt;pointer conv=
ersion. So this is not a case of &quot;string literals are broken now&quot;=
..<br></div></div></blockquote><div><br></div><div>How can you say that pref=
erring a lossy conversion over a lossless one is not broken? (Here, we lose=
 the length information)<br></div></div></blockquote><div><br>Because the &=
quot;lossy conversion&quot; part being preferred has nothing to do with the=
m being string literals. The lossy conversion is not the literal-to-array c=
onversion; it&#39;s the array-to-pointer conversion.<br><br>You&#39;re comp=
laining about the wrong problem.<br><br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding=
-left:1ex"><div dir=3D"ltr"><div></div><div>This make it impossible to work=
 with string literal because they simply don&#39;t exist in the language. T=
his is why I said string literals are broken.</div><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>But there&#39;s no &=
quot;fix&quot; for this, since any array-&gt;pointer &quot;fix&quot; would =
be both wildly incompatible with C and break tons and tons of code. So you =
can either accept the language and work with what we have, or rail against =
it.<br></div></div></blockquote><div></div><div><div><br></div>Ok it&#39;s =
not possible to fix array decay because of=20
backward compatibility, but it is still possible to fix string literals=20
if we make them something that is not an array.</div></div></blockquote><di=
v><br>Why would changing the behavior of string literals be any more backwa=
rds compatible than changing the behavior of arrays? There&#39;s lots of co=
de out there that works with C++&#39;s string literal rules. Can you find a=
 way to change those rules without breaking their code?<br><br>Let me give =
you a simple case: `decltype(&quot;a string literal&quot;)` is an array typ=
e. Therefore, any BC change will have to leave it as an array type. So what=
 rules would you change to fix the problem you want fixed without changing =
the result of that `decltype`?<br><br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><div>So I rail against those defects in order to =
be heard, and maybe, at some point, they will be fixed.</div></div></blockq=
uote><div><br>Yeah, that&#39;s not how this works. You can &quot;rail again=
st those defects&quot; all you like, but unless you&#39;re willing to actua=
lly work on it (ie: finding a solution that doesn&#39;t break the world and=
 getting it through the committee), it will not get fixed. Or you manage to=
 convince someone who&#39;s actually willing to put in said work to do so.<=
br><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>=
If this is not the place to speak out loud about those defects, then where =
should we go?<br></div><div><br></div><div>But don&#39;t get me wrong, when=
 I code, I work with what I have, and I accept the language as it is.<br></=
div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0;ma=
rgin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r"><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margi=
n-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
<div>It&#39;s funny how the more I dig in C++, the more bulky it appears to=
 be just because of these very small annoyances.<br></div><div>=C2=A0</div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br>It&#39;s =
a 3 step process; let&#39;s not interfere in that.<br>=C2=A0</div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><div>We could ha=
ve exatcly the situation with string interpolation:</div><div><div style=3D=
"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-sty=
le:solid;border-width:1px"><code><div><span style=3D"color:#008">auto</span=
><span style=3D"color:#000"> s </span><span style=3D"color:#660">=3D</span>=
<span style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><=
span style=3D"color:#000">concat</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">F</span><span style=3D"color:#080">&quot;{str1}{s=
tr2}{str<wbr>3}&quot;</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#800">// would be equivalen=
t to</span><span style=3D"color:#000"><br></span><span style=3D"color:#008"=
>auto</span><span style=3D"color:#000"> s </span><span style=3D"color:#660"=
>=3D</span><span style=3D"color:#000"> F</span><span style=3D"color:#080">&=
quot;{str1}{str2}{str3}&quot;</span><span style=3D"color:#000">s</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#000"><br></span></div>=
</code></div><br>I don&#39;t see why allowing UDL to work like that would d=
ecrease usability as we could always use regular functions.<br></div></div>=
</blockquote><div><br>Because you can&#39;t do this:<br><br><div style=3D"b=
ackground-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><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">concat</span><=
span style=3D"color:#660">(</span><span style=3D"color:#000">F</span><span =
style=3D"color:#080">&quot;some string {variable} other string&quot;</span>=
<span style=3D"color:#000">sv</span><span style=3D"color:#660">);</span></d=
iv></code></div><br>Under my system, the UDL employed here allows you to de=
cide how to process each of the literal fragments. The UDL applies to the p=
arts of the literal that are actually strings. So `concat` would get `strin=
g_view`s, rather than `const char[X]` parameters.<br><br>Under your system,=
 the processing of the literal fragments is controlled entirely by the syst=
em that computes the aggregation.</div></div></blockquote><div><br></div><d=
iv>Let&#39;s sum up, string literals are broken today. So we should probabl=
y try to solve this big issue before trying to see how we can cripple strin=
g_interpolation in order to fit in current-ish C++.<br></div></div></blockq=
uote><div><br>I fail to see why applying a UDL to the literal fragments rat=
her than the interpolation aggregation operation should be considered &quot=
;crippling&quot; string interpolation.<br><br>Whatever breakage you see in =
literals isn&#39;t standing in the way of string interpolation. It&#39;s ju=
st standing in the way of string interpolation working the way <i>you</i> w=
ant it to.<br></div></div></blockquote><div><br></div><div>Because string i=
nterpolation is dealing with string literals,</div></div></blockquote><div>=
<br>Why does it have to be? If constexpr strings are in the future, it&#39;=
d be really nice if string interpolation were defined in such a way that it=
 could be used on them. Tying interpolation to literals is not forward-thin=
king.<br><br></div><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"=
><div>if those literals are broken (and they are), how can we have a proper=
 string interpolation?</div></div></blockquote><div><br>Because any &quot;b=
rokenness&quot; of string literals has no effect on our ability to use stri=
ng interpolation. If you want sized strings for those string fragments, tha=
t&#39;s what the `sv` suffix is for.<br><br>Literal issues only are a probl=
em for string interpolation because you believe that the suffix ought to be=
 able to define the aggregation operation. If you stop believing that, then=
 all of a sudden, your problem with string literals becomes a non-issue for=
 interpolation.<br><br>It should also be noted that 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:#008">templat=
e</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">ty=
pename</span><span style=3D"color:#000"> T</span><span style=3D"color:#660"=
>&gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008=
">void</span><span style=3D"color:#000"> foo</span><span style=3D"color:#66=
0">(</span><span style=3D"color:#008">const</span><span style=3D"color:#000=
"> T</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000=
"> t</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><=
br><br>foo</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
80">&quot;an array&quot;</span><span style=3D"color:#660">);</span><span st=
yle=3D"color:#000"><br></span></div></code></div><br>The call to `foo` will=
 deduce `T` to be `char[9]`. So a variadic template function that takes the=
 results of string interpolation will get sized array types, not pointers.<=
br><br>Note that this doesn&#39;t invalidate anything I said. The point of =
doing `F&quot;blah {variable} blah&quot;sv` is not necessarily because you =
need them to keep the size around. Using `string_view` has many other advan=
tages, with its member functions, `operator&lt;&lt;` overloads, and the lik=
e. So wanting to apply `sv` to each of the fragments is a perfectly reasona=
ble operation.<br><br>Also, `string_view` is a lot more convenient to use t=
han an array of characters.<br><br></div><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"><div></div><div>You said:</div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div>The point of that discussion was a commen=
t someone made about doing=20
template metaprogramming on string literals. To do that, you need a way=20
to access each literal as a distinct type, some `string_literal&lt;char,
 &#39;c&#39;, &#39;h&#39;, &#39;a&#39;, &#39;r&#39;&gt;` type. And only a U=
DL applied to each fragment=20
can perform that kind of synthesis.</div></blockquote><div><br></div><div>U=
DL is the only way to do it only because string literals are broken. If we =
had proper string literals, it should be possible to do it simply with regu=
lar functions.</div></div></blockquote><div><br>No, it would not. Even if a=
 string literal had a non-array type with a stored size, each literal value=
 would still not have its own distinct <i>type</i>. Even if the size is a t=
emplate argument, two literals can store different characters while still h=
aving the same size. And you cannot do type-based metaprogramming without h=
aving a 1:1 mapping between value and type.<br><br>Remember: while UDL&#39;=
s <i>can</i> take strings as a sequence of character template parameters, t=
here&#39;s a good reason why they aren&#39;t <i>required</i> to do so. We d=
on&#39;t want to force that onto everybody, and a non-&quot;broken&quot; st=
ring literal system would not force that on people.<br><br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>So even with your appro=
ach, broken string literals are a problem for string interpolation. Just no=
t at the same place.</div><div><br></div><div>I&#39;m not sure if my approa=
ch is the right one (it&#39;s probably not), but most of your arguments sta=
nd only because string literal are broken (otherwise, it would have been si=
mple to do the same with my approach too).</div><div><br></div><div>My poin=
t is: yes your approach makes it easier with current C++, but we shouldn&#3=
9;t go for something that works quite well with current C++, but something =
that will work very well with future C++.</div><div>That&#39;s why I think =
it&#39;s better to first fix string literals. And then have string interpol=
ation right the first time.<br></div><div><br></div><div>And btw, if string=
 literals are fixed, string interpolation could be made a library solution =
only ( with a different but reasonable syntax).</div></div></blockquote><di=
v><br>It&#39;s impossible to do that. String interpolation, at its core, is=
 about taking the contents of a string and applying them in some way to the=
 code <i>around</i> that string. A library solution cannot possibly do that=
..<br><br>Oh sure, a `constexpr` function could do the parsing. But then wha=
t? I&#39;m fairly certain that no static reflection proposal provides a mec=
hanism to turn a string into a reference to a local variable. And even if t=
hey did, the location where you&#39;re doing that conversion wouldn&#39;t h=
ave that variable in scope (since it&#39;s in a function call), so it could=
n&#39;t possibly work.<br><br></div><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"><div></div><div>PS: I think it would be preferable to sto=
p the discussion here, as it becomes more and more off-topic.<br></div></di=
v></blockquote><div><br>But what if we don&#39;t agree that string interpol=
ation needs better literals?<br><br>Your premise is essentially that my sug=
gested syntax is some kind of compromise, that if literals weren&#39;t &quo=
t;broken&quot; the way you feel that they are, then it would <i>clearly</i>=
 be correct to have UDLs applied to aggregation rather than to the individu=
al fragments.<br><br>I don&#39;t agree with that premise. Whether literals =
are good or broken is a side issue. Even if we had perfect literals, I woul=
d <i>still</i> rather UDLs be focused on individual string literal manipula=
tion rather than string interpolation aggregation.<br></div></div></blockqu=
ote><div>=C2=A0<br><br>After some toughs I come to conclusion that mixing i=
nterpolation with UDL is limiting thing and this is good thing. Why? Becaus=
e beside good things it limit bad things too.<br>I start from high metaprog=
raming starting point where I made all trader offs to make it work, you sta=
rt from basic usage and use opposite options.<br>As consequence all my exam=
ple of use of string interpolation become unusable in your approach.<br><br=
>We can start with sql, you suggest that version:<br><div style=3D"backgrou=
nd-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;=
border-width:1px"><code><div><span style=3D"color:#000">db</span><span styl=
e=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"c=
olor:#080">&quot;some sql stuff {var1} more sql {var2};&quot;</span><span s=
tyle=3D"color:#660">);</span></div></code></div><br>I can quote someone: &q=
uot;Have we learned nothing from Little Bobby Tables?&quot;, how you want d=
isquisition between `const char*`s parameters?<br>I did not had this proble=
m because I can limit how parameters are pass to UDL and I can relay on it.=
<br>One way to avoid it is add new literal that will help with that but in =
some corner cases it could still break.<br><br><div style=3D"background-col=
or:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border=
-width:1px"><code><div><span style=3D"color:#000">db</span><span style=3D"c=
olor:#660">.</span><span style=3D"color:#008">exec</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#080">&quot;select sth&quot;</span><s=
pan style=3D"color:#000">_sql</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#000"><br>db</span><span style=3D"color:#660">.</span><sp=
an 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;select sth w=
hen {name}&quot;</span><span style=3D"color:#000">_sqlp</span><span style=
=3D"color:#660">);</span><span style=3D"color:#000"> </span><span style=3D"=
color:#800">//as you point outs, &quot;select x&quot; is not sql, we need d=
iffrent postfix.</span><span style=3D"color:#000"><br>tuple</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#000">F</span><span style=3D=
"color:#080">&quot;{name1}{name2}&quot;</span><span style=3D"color:#660">);=
</span><span style=3D"color:#000"> </span><span style=3D"color:#800">//this=
 is `tuple&lt;const char*, const char*&gt;` or `tuple&lt;const char*, const=
 char*, const char*, const char*, const char*&gt;`?</span><span style=3D"co=
lor:#000"><br>tuple</span><span style=3D"color:#660">(</span><span style=3D=
"color:#000">F</span><span style=3D"color:#080">&quot;{name1} {name2}&quot;=
</span><span style=3D"color:#660">);</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">//same type as above?</span><span style=3D"co=
lor:#000"><br>translate</span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#000">F</span><span style=3D"color:#080">&quot;With {part} to {c=
hange}? Can I {change}{order} in any way?&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"co=
lor:#000"> </span><span style=3D"color:#800">//BTW &quot;fr&quot; is part o=
f interpolated string from perspective of this function</span><span style=
=3D"color:#000"><br></span></div></code></div>In my case all this things ca=
n be enclosed in UDL and will not leak outside.<br><br>Another problem is t=
hat even if your version is more flexible you still repeat in multiple of p=
lace usage of specialization point functions otherwise you cant use interpo=
lation without it, in my version you only would need use them in UDL.<br><b=
r>Probably without lot of limitation, many quirks will prevent any serous m=
etaprograming. I&#39;m inclined to thinking that whole idea will not go far=
..<br><br>btw<br><div style=3D"background-color:rgb(250,250,250);border-colo=
r:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span st=
yle=3D"color:#000">f</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">F</span><span style=3D"color:#080">&quot;T{{a}}&quot;</span=
><span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#800">//is `f(&quot;T{{a}}&quot;)` or `f(&quot;T&quot;, {=
a})`?</span><span style=3D"color:#000"><br></span></div></code></div>Where =
both version could compile. Probably safer would be follow JS version where=
 we it use `${` to start interpolation.<br><br></div></div></blockquote><di=
v><br></div><div>This could stop Little Bobby Tables:</div><div><br></div><=
div class=3D"m_1712141763930148073prettyprint" style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code class=3D"m_1712141763930148073prettyprint=
"><div class=3D"m_1712141763930148073subprettyprint"><span style=3D"color:#=
000" class=3D"m_1712141763930148073styled-by-prettify">f</span><span style=
=3D"color:#660" class=3D"m_1712141763930148073styled-by-prettify">(</span><=
span style=3D"color:#000" class=3D"m_1712141763930148073styled-by-prettify"=
>F</span><span style=3D"color:#080" class=3D"m_1712141763930148073styled-by=
-prettify">&quot;{a}{b}&quot;</span><span style=3D"color:#660" class=3D"m_1=
712141763930148073styled-by-prettify">);</span><span style=3D"color:#000" c=
lass=3D"m_1712141763930148073styled-by-prettify"><br></span></div></code></=
div><div><br></div><div>could translate to</div><div><br></div><div class=
=3D"m_1712141763930148073prettyprint" style=3D"background-color:rgb(250,250=
,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wor=
d-wrap:break-word"><code class=3D"m_1712141763930148073prettyprint"><div cl=
ass=3D"m_1712141763930148073subprettyprint"><span style=3D"color:#000" clas=
s=3D"m_1712141763930148073styled-by-prettify">f</span><span style=3D"color:=
#660" class=3D"m_1712141763930148073styled-by-prettify">(</span><span style=
=3D"color:#080" class=3D"m_1712141763930148073styled-by-prettify">&quot;&qu=
ot;</span><span style=3D"color:#660" class=3D"m_1712141763930148073styled-b=
y-prettify">,</span><span style=3D"color:#000" class=3D"m_17121417639301480=
73styled-by-prettify"> a</span><span style=3D"color:#660" class=3D"m_171214=
1763930148073styled-by-prettify">,</span><span style=3D"color:#000" class=
=3D"m_1712141763930148073styled-by-prettify"> </span><span style=3D"color:#=
080" class=3D"m_1712141763930148073styled-by-prettify">&quot;&quot;</span><=
span style=3D"color:#660" class=3D"m_1712141763930148073styled-by-prettify"=
>,</span><span style=3D"color:#000" class=3D"m_1712141763930148073styled-by=
-prettify"> b</span><span style=3D"color:#660" class=3D"m_17121417639301480=
73styled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_1712141=
763930148073styled-by-prettify"> </span><span style=3D"color:#080" class=3D=
"m_1712141763930148073styled-by-prettify">&quot;&quot;</span><span style=3D=
"color:#660" class=3D"m_1712141763930148073styled-by-prettify">);</span><sp=
an style=3D"color:#000" class=3D"m_1712141763930148073styled-by-prettify"><=
br></span></div></code></div><div><br><br></div><div>arguments 0, ..., 2n a=
re always literals and 1, ..., 2n-1 are always expressions.</div><div><br><=
/div><div><div class=3D"m_1712141763930148073prettyprint" style=3D"backgrou=
nd-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;=
border-width:1px;word-wrap:break-word"><code class=3D"m_1712141763930148073=
prettyprint"><div class=3D"m_1712141763930148073subprettyprint"><span style=
=3D"color:#000" class=3D"m_1712141763930148073styled-by-prettify">f</span><=
span style=3D"color:#660" class=3D"m_1712141763930148073styled-by-prettify"=
>(</span><span style=3D"color:#000" class=3D"m_1712141763930148073styled-by=
-prettify">F</span><span style=3D"color:#080" class=3D"m_171214176393014807=
3styled-by-prettify">&quot;T{{a}}&quot;</span><span style=3D"color:#660" cl=
ass=3D"m_1712141763930148073styled-by-prettify">);</span></div></code></div=
><span style=3D"font-family:monospace;background-color:rgb(250,250,250);col=
or:rgb(102,102,0)"><br></span></div><div>would be=C2=A0</div><div><br></div=
><div class=3D"m_1712141763930148073prettyprint" style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code class=3D"m_1712141763930148073prettypri=
nt"><div class=3D"m_1712141763930148073subprettyprint"><span style=3D"color=
:#000" class=3D"m_1712141763930148073styled-by-prettify">f</span><span styl=
e=3D"color:#660" class=3D"m_1712141763930148073styled-by-prettify">(</span>=
<span style=3D"color:#080" class=3D"m_1712141763930148073styled-by-prettify=
">&quot;&quot;</span><span style=3D"color:#660" class=3D"m_1712141763930148=
073styled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_171214=
1763930148073styled-by-prettify"> </span><span style=3D"color:#660" class=
=3D"m_1712141763930148073styled-by-prettify">{</span><span style=3D"color:#=
000" class=3D"m_1712141763930148073styled-by-prettify">a</span><span style=
=3D"color:#660" class=3D"m_1712141763930148073styled-by-prettify">},</span>=
<span style=3D"color:#000" class=3D"m_1712141763930148073styled-by-prettify=
"> </span><span style=3D"color:#080" class=3D"m_1712141763930148073styled-b=
y-prettify">&quot;&quot;</span><span style=3D"color:#660" class=3D"m_171214=
1763930148073styled-by-prettify">)</span><span style=3D"color:#000" class=
=3D"m_1712141763930148073styled-by-prettify"><br></span></div></code></div>=
<div><br></div><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" 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/c753942d-be11-4cc0-bde1-7f71b6184367%=
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/c753=
942d-be11-4cc0-<wbr>bde1-7f71b6184367%40isocpp.org</a><wbr>.<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%2B0CCPrAspxkZJXbhJyc9UCXS3FAw3UU0=
GEvAzURwKG1-pvoA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCPrAspx=
kZJXbhJyc9UCXS3FAw3UU0GEvAzURwKG1-pvoA%40mail.gmail.com</a>.<br />

--94eb2c04f868cc4418056521fdc6--

.
