C++ Logo

std-proposals

Advanced search

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

From: Mike Reed <mike_at_[hidden]>
Date: Sat, 14 Oct 2023 09:38:06 +0100
Is it me or do you keep saying "semi colon" when you mean "colon"? e.g.

If the replacement-field has a semi-colon :

Mike.
P.S. I like this proposal.

On Fri, 13 Oct 2023, 11:58 Hadriel Kaplan via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> Back in 2019, https://wg21.link/p1819r0 was submitted for "interpolated
> literals". I believe it was reviewed in EWG-Incubator back then, and again
> in 2022. There appears to have been consensus for the author to keep
> working on it generally, but no consensus on the proposal's specific
> details.
>
> I'd like to propose a different solution - but only for the specific idea
> of having f-strings in C++, as opposed to a general string-interpolation
> framework.
>
> I've written up a brief strawman here: https://tinyurl.com/3tr8rv22
>
> The basic idea is to just syntactically replace an f-string with its
> std::format() counterpart, as a new step between phase 6 and 7 of
> translation, right after concatenation of string-literals. I.e., an
> f-string would just be syntactic-sugar for std::format().
>
> More-detailed rules are written in the linked proposal above. It even
> includes a way to add a customization point should that be desired by the
> WG, at which point it's a form of interpolation and could perhaps fully
> replace P1819.
>
> It's arguably a bit hacky, but it should be far simpler than P1819 to
> implement, use, and maybe even standardize.
>
> I'm looking for feedback on whether this is an idea worth pursuing, or
> whether it's a horrible idea and I should never raise it again.
>
> -hadriel
>
>
>
> Juniper Public
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-10-14 08:38:17