220 36944 <ddf515c9-70f6-401b-93eb-b412128779a0@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: inkwizytoryankes@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: String interpolation
Date: Fri, 16 Feb 2018 13:39:41 -0800 (PST)
Lines: 653
Approved: news@gmane.org
Message-ID: <ddf515c9-70f6-401b-93eb-b412128779a0@isocpp.org>
References: <356d5835-f1bf-4699-94f5-0b2d3d0b9c0e@isocpp.org>
 <CAMD6iD9aT26x8GQHnQL+kuj3Rq8fVQSfYYFtvTnFidkf6jU_ag@mail.gmail.com>
 <25CCF885-86AD-4D51-8F5C-C46376D34DE0@gmail.com>
 <4890431.TR9UepuQra@tjmaciei-mobl1>
 <CALvx3hac77b6Z=EOWzKqynALi1-352OvY0dnnOer8rN6tfa01g@mail.gmail.com>
 <1cdb6300-7397-46d7-bce9-62e6e8dac40b@isocpp.org>
 <CAC+0CCOSZHaTA=YPSDU8Add7mE_BYcYPRCmGW8TRPtZhdqL8Hw@mail.gmail.com>
 <4bce681e-e729-4124-9322-69291fdb6678@isocpp.org>
 <758ab0a7-8946-43d4-b2ae-5a4acea11c20@isocpp.org>
 <CAC+0CCOovuF+HGepUDQVjkSJoCbGHBNcemaUU9h_gBUPD9ns+w@mail.gmail.com>
 <CAFQaeCBywEdaj1MD0bpyxcjXRkF1jGaCOcpk=4vHtSjEbYbcJw@mail.gmail.com>
 <01057924-056c-4ee5-a19c-e070d053b982@isocpp.org>
 <CAC+0CCM0SLuJk3GPA-zqb_X7z-kY_tNF1iLnOocLJwP9eErnLQ@mail.gmail.com>
 <c74fcb96-ed06-4360-bedf-e902b000b13b@isocpp.org>
 <3a738e91-f935-4d11-ab6b-771048b556d4@isocpp.org>
 <96860b9e-95ea-466a-825c-c371844a45e2@isocpp.org>
 <0caab177-cf57-cab1-a5d5-0fc65f651491@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4974_86121140.1518817181891"
X-Trace: blaine.gmane.org 1518817086 18422 195.159.176.226 (16 Feb 2018 21:38:06 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Feb 2018 21:38:06 +0000 (UTC)
Cc: jmckesson@gmail.com, florian.csdt@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDDLTAGNTIBBBH47TXKAKGQECKZYH3I@isocpp.org Fri Feb 16 22:38:02 2018
Return-path: <std-proposals+bncBDDLTAGNTIBBBH47TXKAKGQECKZYH3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f70.google.com ([209.85.213.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDDLTAGNTIBBBH47TXKAKGQECKZYH3I@isocpp.org>)
	id 1emnhK-0002xf-Gj
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Feb 2018 22:37:38 +0100
Original-Received: by mail-vk0-f70.google.com with SMTP id r4sf945811vke.17
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Feb 2018 13:39:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=oPGLrPm9j6tT3+4Mn6ouZcTUZtFO8Dxb+VSnEQkWN0w=;
        b=tgPaJFXbKXS2iRMS9o5neIMRIwkYsqZ93QRXgQ+FUWRoWJjuNBeem9hrLlbH93232R
         X2RYMoCiezoDDyiE07oqxxp+eAbbxtJag1ipzyK96uEfbcoWhTj8M9iGZ+h7oCtxUQW3
         FsXhs10NPO8b/URLzHMAZ1D9OFt6w4A6L6pXUGcDI62mi8F47ZUUUkM9q0qCRGqyp/F8
         uLpBbjt2hCtN/O6qIi87+z4kSyFYsK20YSdQVIREpeUkGbYhp6m5qjSH+O/RHhARHZOv
         cg+AXvSYHJNR4So1jFFszgTFwA7u1dvsqux5C7qwcAuffRhnGg/jtBk+WtSdITxlyN+I
         aoQA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=oPGLrPm9j6tT3+4Mn6ouZcTUZtFO8Dxb+VSnEQkWN0w=;
        b=QwrkZt3KUwZwpEFHQu7O2V/3nqOn/AyjFjfrPV591UtPj4cMokKZrit+k3QHVgBUL7
         qAsn+1zx5LotRSeOz/9nRhgbMaB6568LD3au4xd4HE46tKSFO07GXdQUD2+mRz0yLlsx
         iXoeVJOO8eLipiOjnPxpXwwKKKb+uLxQXAnY1V8aaapQttts4i9REMePOgDIQCotaGOc
         oOlrhS+5dnqaBUqFO2Mor+F8mS2FCxAZq6ZbS+lm+pSWRCGyEBrWIXKxlxAonV35lxlH
         Jikrn4UyhW+4TNadl6sOG9tGyO2jlXeLf4z1U9kgGD6Nz+VEArnFjx847N9PK18B9Xv5
         JxGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=oPGLrPm9j6tT3+4Mn6ouZcTUZtFO8Dxb+VSnEQkWN0w=;
        b=H0YDUOhI/k3lqol3Du80szOE3DpF71+t0GFLAlPOpV50WhcKZ728CqNVbesI6GOqqe
         hrJyFDoWc9Kaf2JDZkNqytT82x8R9sHP5lqqZygGcSoZUfw61977cBiOY93UT8Na1eom
         YlSrlOeGdb+G8K9rLRE831PbF44tD60rP5yYa6qPbqIMOJId6s12SzhDsYrf3/ippuwA
         WKA4bTz9irwNtfJLSTEx9PT8mc/YTzEmhc3bPwpyXbBUq9Zn2bhgl9HntmO2Uosv9ULu
         JVNlsQKAnjoDhqlQhHryvFy1oC2LEbV02lYk4IokBWlxxl0Sk1gT7oqZUX8WQppSvBol
         xg6w==
X-Gm-Message-State: APf1xPAFQyeORIN3d+F6kdz4f/QUuwq5MYrhn4ScI4n8xok4fItMeMtP
	ncVpcqXWzdRqlfdE/YzvMej99A==
X-Google-Smtp-Source: AH8x226eSiqD/CZXJ6rHXKiSTEwqgoSV6brevI7alBSUFnMepqypourPV2exNskJaG9BvaTvKsF7Vw==
X-Received: by 10.176.84.197 with SMTP id q5mr3713607uaa.114.1518817184442;
        Fri, 16 Feb 2018 13:39:44 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.164.68 with SMTP id n65ls1773697vke.0.gmail; Fri, 16 Feb
 2018 13:39:42 -0800 (PST)
X-Received: by 10.31.128.137 with SMTP id b131mr1158612vkd.7.1518817182596;
        Fri, 16 Feb 2018 13:39:42 -0800 (PST)
In-Reply-To: <0caab177-cf57-cab1-a5d5-0fc65f651491@gmail.com>
X-Original-Sender: inkwizytoryankes@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:36944
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36944>

------=_Part_4974_86121140.1518817181891
Content-Type: multipart/alternative; 
	boundary="----=_Part_4975_1051887967.1518817181892"

------=_Part_4975_1051887967.1518817181892
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Thursday, February 15, 2018 at 11:54:14 PM UTC+1, Florian Lemaitre wrote=
:
>
> On 15/02/2018 20:39, Nicol Bolas wrote:
>
> On Thursday, February 15, 2018 at 11:33:26 AM UTC-5, floria...@gmail.com=
=20
> wrote:=20
>>
>> Le jeudi 15 f=C3=A9vrier 2018 17:19:29 UTC+1, Nicol Bolas a =C3=A9crit :=
=20
>>>
>>> On Thursday, February 15, 2018 at 11:06:10 AM UTC-5, Jake Arkinstall=20
>>> wrote:=20
>>>>
>>>> On 15 Feb 2018 15:51, "Nicol Bolas" <jmck...@gmail.com> wrote:
>>>>
>>>> Taking a literal (or possibly constexpr string?)
>>>>
>>>>
>>>> I was wondering whether it makes sense to even describe these things a=
s=20
>>>> literals, given that they aren't literal and given that they aren't=20
>>>> intended to actually be stored in memory in any way.
>>>>
>>>
>>> We still call literals "literals", even if you use them entirely at=20
>>> compile-time via `constexpr` tricks, such that no runtime code ever nee=
ds=20
>>> them. Things between quotes are literals.
>>>
>>> But in terms of constexpr strings, I guess these things themselves can=
=20
>>>> be built up by other methods - I'm not sure if this makes sense in=20
>>>> compilation, though; I'm under the impression that the expression itse=
lf=20
>>>> would likely need to be processed before the constexpr methods themsel=
ves=20
>>>> could be evaluated (especially given that they could themselves utilis=
e=20
>>>> interpolation). I could be wrong.
>>>>
>>>> I think, at this point, interpolation is a bad word - it made sense in=
=20
>>>> the initial form, but now this has generalised we might want a new wor=
d for=20
>>>> it.
>>>>
>>>
>>> I don't agree. "String interpolation" often carries the connotation tha=
t=20
>>> you're just going to concatenate strings, but it doesn't *have* to. C++=
=20
>>> sometimes defines concepts with names that are similar to other languag=
e=20
>>> features, but in a more open and freeform way. Lambdas for example don'=
t=20
>>> have lexical scoping in C++ unless you explicitly ask for them, whereas=
=20
>>> most languages give it to you as a matter of course.
>>>
>>> (or possibly arbitrary expressions?)
>>>>
>>>>
>>>> This wouldn't be so much of a problem, because those expressions (othe=
r=20
>>>> than their declarations) don't need to be completely understood when t=
he=20
>>>> [insert better name for interpolation] is performed - just the resulti=
ng=20
>>>> type is needed.
>>>>
>>>
>>> The issue with "arbitrary expression" is that you're now requiring the=
=20
>>> compiler to *invoke the compiler*. It's easy for the compiler to take a=
=20
>>> compile-time string and find a variable in scope that matches it. It's =
much=20
>>> harder (presumably) for the compiler to take a compile-time string and=
=20
>>> invoke the compiler on it, within the current scope as if it had been=
=20
>>> written text.
>>>
>>> I'm not saying its impossible; I don't know much about compiler=20
>>> architecture. But I can't imagine it's as easy as just finding a variab=
le=20
>>> with that name.
>>>
>>> Not only that, once you get into wanting `constexpr` strings that can b=
e=20
>>> interpolated, you get into lots of issues. Do you really want a feature=
=20
>>> where you're able to synthesize arbitrary expressions and have someone=
=20
>>> insinuate them into their code at compile time?
>>>
>>> Or... maybe you do?
>>>
>>
>> From what I know about compilation and formal languages in general, it=
=20
>> shouldn't be very hard for a compiler to deal with expressions within=20
>> `F"{}"`.
>> The compiler already do that kind of stuff with parentheses. Compilers=
=20
>> are by nature recursive.
>>
>
> You don't seem to be fully understanding what we're talking about. This=
=20
> isn't standard recursive-descent recursion. This is "execute some constex=
pr=20
> code and then run the compiler on part of its string results." Those=20
> "results" might include things like *macros*, and macro expansion is=20
> supposed to have happened long before executing constexpr functions.
>
> And you can't just say they're expressions minus macros. Many C-standard=
=20
> library facilities are, or might be, macros after all. Is it legal to do=
=20
> `F"{sin(foo)}"`? If string interpolation is supposed to allow arbitrary=
=20
> expressions, it would be odd indeed if it were not. What about invoking=
=20
> `offsetof` or similar C-isms?
>
> If we're only going to allow string interpolation with genuine literals,=
=20
> then this isn't much of a problem. Even the macro issue can be sorted out=
,=20
> since the string is right there in the text of the source code.
>
> But if we want string interpolation to ever be applied to the results of=
=20
> compile-time execution, that's going to be *much* more complex if string=
=20
> interpolation can handle arbitrary expressions. Whereas if we define it t=
o=20
> just be variable identifiers, extending such interpolation to constexpr=
=20
> strings would be much more reasonable.
>
> I would say that any proposal should be focused on the minimum featureset=
..=20
> It should naturally include expanding into arbitrary expressions and=20
> constexpr strings as future directions things could take, but I wouldn't=
=20
> push for them in the short term. Sort of like how `constexpr` functions i=
n=20
> C++11 were really limited, which C++14 greatly expanded.
>
> The only thing I don't know is if the compiler deals with string literals=
=20
>> as a single token or not. If they do, string literal parser will have to=
 be=20
>> modified quite a lot, even with the "identifier-only" variant.
>>
>
> First thing first, currently the C++ is oblivious to the preprocessor, an=
d=20
> this will probably not change in the forseeable future (note that the=20
> preprocessor is somehow aware of C++: __cplusplus macro, #include,=20
> __has_cpp_attribute...).
> But as far as the compiler is concerned, these are two distinct steps tha=
t=20
> are processed one after the other, without going back.
>
> Maybe you want to change that, but I think you were mentionning macros=20
> taking effect within F"{}".
> For instance:
> #define Foo 5
> F"{Foo}";
> would expand to:
> F"{5}";
>
> This has basicaly nothing to do with C++, just the preprocessor should be=
=20
> aware that F"{ and }" are somehow similar to parentheses and it should=20
> process the inner part as usual.
> I am simplifying here, but the idea is there. No coming back from C++ to=
=20
> the preprocessor here.
>
> If this is not what you have in mind, please correct me.
>
>
This is impossible, macros can't work with interpolation (at least not in=
=20
broken way).
Consider this code:

#define X C}E
F"A{X}B"; // `"A", C , " E}B"`

#define Y(X) F"A{X}B";
Y(a}Y{c); // `"A", a, "Y", c, "B"`


#define Z {B
F"A{Z}C"; // `"A{B}C"` normal string!

#define W(A, B) F"{A B}"
W({{, b) // `"{", b`
W(a}, b) // `a, " B}"` or `a, " b}"`?
W({, b) // `"{ b}"` or `"{ B}"`?

#define LL(P, A) P##"{A}"
LL(F, a) // `F"{A}"` or `F"{a}"`?

#define RR(_HERE_) FR"{AA}( A ){_HERE_}" FR"{AA}( B ){AA}" //second `FR`=20
should be part of raw string, true end is last `){AA}"`
RR(AA) // `FR"{AA}( A ){AA}" FR"{AA}( B ){AA}"` =3D> `F" A " F" B "` =3D> `=
F" A=20
 B "` or `F" A ){AA}\" FR\"{AA}( B "`?



This will be pain in a** to implement, probably lot of easier will be by=20
replacing `{` by `"`, at least all tools and processor will be easier to=20
adjust to support this.
Then why not this work this way:
F"A "b" B "c" D"_postfix
But this could have confusing part that last symbol is postfix or variable=
=20
named `_postfix`?








--=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/ddf515c9-70f6-401b-93eb-b412128779a0%40isocpp.or=
g.

------=_Part_4975_1051887967.1518817181892
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, February 15, 2018 at 11:54:14 PM UTC+=
1, Florian Lemaitre wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div text=3D"#000000" bgcolor=3D"#FFFFFF">
    On 15/02/2018 20:39, Nicol Bolas wrote:<br>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">On Thursday, February 15, 2018 at 11:33:26 AM
        UTC-5, <a>floria...@gmail.com</a> wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">Le jeudi 15 f=C3=A9vrier 2018 17:19:29 UTC+1, Ni=
col
            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">On Thursday, February 15, 2018 at 11:06:10
                AM UTC-5, Jake Arkinstall wrote:
                <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-=
left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div dir=3D"auto">
                    <div>
                      <div>
                        <div class=3D"gmail_quote">On 15 Feb 2018 15:51,
                          &quot;Nicol Bolas&quot; &lt;<a rel=3D"nofollow">j=
mck...@gmail.com</a>&gt;
                          wrote:<br type=3D"attribution">
                          <blockquote style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex">
                            <div dir=3D"ltr">
                              <div>Taking a literal (or possibly
                                constexpr string?)</div>
                            </div>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                    <div dir=3D"auto"><br>
                    </div>
                    <div dir=3D"auto">I was wondering whether it makes
                      sense to even describe these things as literals,
                      given that they aren&#39;t literal and given that the=
y
                      aren&#39;t intended to actually be stored in memory i=
n
                      any way.</div>
                  </div>
                </blockquote>
                <div><br>
                  We still call literals &quot;literals&quot;, even if you =
use
                  them entirely at compile-time via `constexpr` tricks,
                  such that no runtime code ever needs them. Things
                  between quotes are literals.<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"auto">
                    <div dir=3D"auto">But in terms of constexpr strings, I
                      guess these things themselves can be built up by
                      other methods - I&#39;m not sure if this makes sense
                      in compilation, though; I&#39;m under the impression
                      that the expression itself would likely need to be
                      processed before the constexpr methods themselves
                      could be evaluated (especially given that they
                      could themselves utilise interpolation). I could
                      be wrong.</div>
                    <div dir=3D"auto"><br>
                    </div>
                    <div dir=3D"auto">I think, at this point,
                      interpolation is a bad word - it made sense in the
                      initial form, but now this has generalised we
                      might want a new word for it.</div>
                  </div>
                </blockquote>
                <div><br>
                  I don&#39;t agree. &quot;String interpolation&quot; often=
 carries
                  the connotation that you&#39;re just going to concatenate
                  strings, but it doesn&#39;t <i>have</i> to. C++ sometimes
                  defines concepts with names that are similar to other
                  language features, but in a more open and freeform
                  way. Lambdas for example don&#39;t have lexical scoping i=
n
                  C++ unless you explicitly ask for them, whereas most
                  languages give it to you as a matter of course.<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"auto">
                    <div dir=3D"auto">
                      <div>
                        <div class=3D"gmail_quote">
                          <blockquote style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex">
                            <div dir=3D"ltr">
                              <div>(or possibly arbitrary expressions?)</di=
v>
                            </div>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                    <div dir=3D"auto"><br>
                    </div>
                    <div dir=3D"auto">This wouldn&#39;t be so much of a
                      problem, because those expressions (other than
                      their declarations) don&#39;t need to be completely
                      understood when the [insert better name for
                      interpolation] is performed - just the resulting
                      type is needed.</div>
                  </div>
                </blockquote>
                <div><br>
                  The issue with &quot;arbitrary expression&quot; is that y=
ou&#39;re
                  now requiring the compiler to <i>invoke the compiler</i>.
                  It&#39;s easy for the compiler to take a compile-time
                  string and find a variable in scope that matches it.
                  It&#39;s much harder (presumably) for the compiler to tak=
e
                  a compile-time string and invoke the compiler on it,
                  within the current scope as if it had been written
                  text.<br>
                  <br>
                  I&#39;m not saying its impossible; I don&#39;t know much =
about
                  compiler architecture. But I can&#39;t imagine it&#39;s a=
s
                  easy as just finding a variable with that name.<br>
                  <br>
                  Not only that, once you get into wanting `constexpr`
                  strings that can be interpolated, you get into lots of
                  issues. Do you really want a feature where you&#39;re abl=
e
                  to synthesize arbitrary expressions and have someone
                  insinuate them into their code at compile time?<br>
                  <br>
                  Or... maybe you do?<br>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>From what I know about compilation and formal languages
              in general, it shouldn&#39;t be very hard for a compiler to
              deal with expressions within `F&quot;{}&quot;`.</div>
            <div>The compiler already do that kind of stuff with
              parentheses. Compilers are by nature recursive.</div>
          </div>
        </blockquote>
        <div><br>
          You don&#39;t seem to be fully understanding what we&#39;re talki=
ng
          about. This isn&#39;t standard recursive-descent recursion. This
          is &quot;execute some constexpr code and then run the compiler on
          part of its string results.&quot; Those &quot;results&quot; might=
 include
          things like <i>macros</i>, and macro expansion is supposed to
          have happened long before executing constexpr functions.<br>
          <br>
          And you can&#39;t just say they&#39;re expressions minus macros. =
Many
          C-standard library facilities are, or might be, macros after
          all. Is it legal to do `F&quot;{sin(foo)}&quot;`? If string
          interpolation is supposed to allow arbitrary expressions, it
          would be odd indeed if it were not. What about invoking
          `offsetof` or similar C-isms?<br>
          <br>
          If we&#39;re only going to allow string interpolation with genuin=
e
          literals, then this isn&#39;t much of a problem. Even the macro
          issue can be sorted out, since the string is right there in
          the text of the source code.<br>
          <br>
          But if we want string interpolation to ever be applied to the
          results of compile-time execution, that&#39;s going to be <i>much=
</i>
          more complex if string interpolation can handle arbitrary
          expressions. Whereas if we define it to just be variable
          identifiers, extending such interpolation to constexpr strings
          would be much more reasonable.<br>
          <br>
          I would say that any proposal should be focused on the minimum
          featureset. It should naturally include expanding into
          arbitrary expressions and constexpr strings as future
          directions things could take, but I wouldn&#39;t push for them in
          the short term. Sort of like how `constexpr` functions in
          C++11 were really limited, which C++14 greatly expanded.<br>
          <br>
        </div>
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">
            <div>The only thing I don&#39;t know is if the compiler deals
              with string literals as a single token or not. If they do,
              string literal parser will have to be modified quite a
              lot, even with the &quot;identifier-only&quot; variant.<br>
            </div>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <div>First thing first, currently the C++ is oblivious to the
      preprocessor, and this will probably not change in the forseeable
      future (note that the preprocessor is somehow aware of C++:
      __cplusplus macro, #include, __has_cpp_attribute...).</div>
    <div>But as far as the compiler is concerned, these are two distinct
      steps that are processed one after the other, without going back.</di=
v>
    <div><br>
    </div>
    <div>Maybe you want to change that, but I think you were mentionning
      macros taking effect within F&quot;{}&quot;.</div>
    <div>For instance:</div>
    <div>
      <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:#800">#define</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">Foo</span><span style=3D"color:#=
000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#000">=
<br>
              F</span><span style=3D"color:#080">&quot;{Foo}&quot;</span><s=
pan style=3D"color:#660">;</span><span style=3D"color:#000"><br>
            </span></div>
        </code></div>
      would expand to:</div>
    <div>
      <div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px"><code>
          <div><span style=3D"color:#000">F</span><span style=3D"color:#080=
">&quot;{5}&quot;</span><span style=3D"color:#660">;</span></div>
        </code></div>
    </div>
    <div><br>
    </div>
    <div>This has basicaly nothing to do with C++, just the preprocessor
      should be aware that F&quot;{ and }&quot; are somehow similar to pare=
ntheses
      and it should process the inner part as usual.</div>
    <div>I am simplifying here, but the idea is there. No coming back
      from C++ to the preprocessor here.</div>
    <div><br>
    </div>
    <div>If this is not what you have in mind, please correct me.<br>
    </div><br></div></blockquote><div><br>This is impossible, macros can&#3=
9;t work with interpolation (at least not in broken way).<br>Consider this =
code:<br><span style=3D"color: #a31515;"><div style=3D"background-color: rg=
b(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bo=
rder-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">#define</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> X C</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">E<br>F</span><span style=3D"color: #080;" class=3D"styled-by-prett=
ify">&quot;A{X}B&quot;</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// `&q=
uot;A&quot;, C , &quot; E}B&quot;`</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">#define</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> Y</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> F</span><span=
 style=3D"color: #080;" class=3D"styled-by-prettify">&quot;A{X}B&quot;</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>Y</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">a</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">Y</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">c</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">// `&quot;A&quot;, a, &q=
uot;Y&quot;, c, &quot;B&quot;`</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br><br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">#define</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> Z </span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">B<br>F</span><span style=3D"color: #080;" class=3D"styled-by-prettify"=
>&quot;A{Z}C&quot;</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">// `&quot;=
A{B}C&quot;` normal string!</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br></span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">#define</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> W</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">A</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> B</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> F</span><span style=3D"color: #080;" cl=
ass=3D"styled-by-prettify">&quot;{A B}&quot;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>W</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">({{,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
 `&quot;{&quot;, b`</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>W</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">},</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// `a, &quot; B}&quot;` or `a, &quot; b}&quot;=
`?</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>W</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">({,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// `&quot;{ b}&quot;` or `&quot;{ B}&quot;`?</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">#define</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> LL</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">P</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> P</span><span style=3D"color: #800;" class=3D"styled-by-prettify">#=
#&quot;{A}&quot;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>LL</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">F</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// `F&quot;{A}&quot;` or `F&quot;{a}&quot;`?</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">#define</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> RR</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">_HERE_</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> FR</span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">&quot;{AA}( A ){_HERE_}&quot;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> FR</span><span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&quot;{AA}( B ){AA}&quot;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//second `FR` should be part of raw s=
tring, true end is last `){AA}&quot;`</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>RR</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">AA</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">// `FR&quot=
;{AA}( A ){AA}&quot; FR&quot;{AA}( B ){AA}&quot;` =3D&gt; `F&quot; A &quot;=
 F&quot; B &quot;` =3D&gt; `F&quot; A =C2=A0B &quot;` or `F&quot; A ){AA}\&=
quot; FR\&quot;{AA}( B &quot;`?</span></div></code></div><br><br></span><br=
>This will be pain in a** to implement, probably lot of easier will be by r=
eplacing `{` by `&quot;`, at least all tools and processor will be easier t=
o adjust to support this.<br>Then why not this work this way:<br><div style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; overflow-wrap: break-word;" class=
=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #000;" class=3D"styled-by-prettify">F</span><span sty=
le=3D"color: #080;" class=3D"styled-by-prettify">&quot;A &quot;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">b</span><span style=3D=
"color: #080;" class=3D"styled-by-prettify">&quot; B &quot;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">c</span><span style=3D"col=
or: #080;" class=3D"styled-by-prettify">&quot; D&quot;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">_postfix</span></div></code></d=
iv>But this could have confusing part that last symbol is postfix or variab=
le named `_postfix`?<br><br><br><br><br><br><br><br><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/ddf515c9-70f6-401b-93eb-b412128779a0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ddf515c9-70f6-401b-93eb-b412128779a0=
%40isocpp.org</a>.<br />

------=_Part_4975_1051887967.1518817181892--

------=_Part_4974_86121140.1518817181891--

.
