C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Newlines in F-strings

From: Chris Gary <cgary512_at_[hidden]>
Date: Tue, 24 Oct 2023 19:23:19 -0600
Ok, I was somehow under the impression that the other prefix was either
exemplary or abandoned...
To your point, that makes sense from an ease-of-use perspective. If there
is opposition to adding two more prefixes, I would suggest the "X"-version
of the "F"-prefix (keeping the "F" prefix).

On Tue, Oct 24, 2023 at 7:17 PM Hadriel Kaplan <hkaplan_at_[hidden]> wrote:

>
> Juniper Public
> > From: Std-Proposals <std-proposals-bounces_at_[hidden] <mailto:
> std-proposals-bounces_at_[hidden]>> on behalf of Chris Gary via
> Std-Proposals <std-proposals_at_[hidden] <mailto:
> std-proposals_at_[hidden]>>
> > Date: Tuesday, October 24, 2023 at 7:53 PM
>
> > Also, expanding directly to std::format would limit this to cases where
> only the appropriate std::string variant can be used. While it may seem
> inconvenient, being able to do something like this:
>
> I was only showing examples using F"", and std::format, because I think
> it's easier to see how they expand/interpolate, since there are parentheses
> and such.
>
>
> For purely string-interpolation, one would use X"", which extracts the
> expressions into their separate arguments.
>
> So you could use it like this:
>
> std::print(X"Values of {gamma} may give rise to {condition}");
>
> FormatQString(X"Values of {gamma} may give rise to {condition}");
>
>
> Which would become these:
>
> std::print("Values of {} may give rise to {}", gamma, condition);
>
> FormatQString("Values of {} may give rise to {}", gamma, condition);
>
>
> -hadriel
>
>
>

Received on 2023-10-25 01:23:32