C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Supporting f-strings in C++: draft-R1

From: Hadriel Kaplan <hkaplan_at_[hidden]>
Date: Sun, 15 Oct 2023 11:19:50 +0000
I've posted a second revision of the draft here: https://tinyurl.com/y7av5tbw

This incorporates some of the feedback, adds some more details, and proposes the two separate types: f-strings and x-strings, with f-string just being sugar for `std::format(X"...")`.

Thanks for the feedback - I think it really improved the proposal.

-hadriel


> From: Hadriel Kaplan <hkaplan_at_[hidden]>

> OK, then how about compromise-B: two prefixes...
> Let X"" expand this:
> X"{prefix}_{name}: got {calculate()} for {bits:#06x}"
> To this:
> "{}_{}: got {} for {:#06x}", prefix, name, calculate(), bits
> And let F"" expand this:
> F"{prefix}_{name}: got {calculate()} for {bits:#06x}"
> To this:
> std::format("{}_{}: got {} for {:#06x}", prefix, name, calculate(), bits)
> And obviously we could specify F"" as just being `::std::format(X"")` internally.





Juniper Public

Received on 2023-10-15 11:19:56