C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sun, 15 Oct 2023 16:50:55 +0200
Hi Hadriel, you write that there is no preprocessor support within the f-strings.   Is it possible to concatenate preprocessor macro results with preprocessor string concatenation? If yes, would it be further possible to have the preprocessor preprocess code in its usual way, put it through a STRINGIFY macro and concatenate it into the f string?   -----Ursprüngliche Nachricht----- Von:Hadriel Kaplan via Std-Proposals <std-proposals_at_[hidden]> Gesendet:So 15.10.2023 13:20 Betreff:Re: [std-proposals] Supporting f-strings in C++: draft-R1 An:std-proposals_at_[hidden]; CC:Hadriel Kaplan <hkaplan_at_[hidden]>; 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 -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-10-15 14:50:57