C++ Logo

std-proposals

Advanced search

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

From: Hadriel Kaplan <hkaplan_at_[hidden]>
Date: Thu, 19 Oct 2023 08:27:03 +0000
> From: Tom Honermann <tom_at_[hidden]>

> > But do we expect any of these to compile, and if so which ones?:
> > 1) X"a={a}" X"b={b}"
> > 2) X"a={a}" "b={b}"
> > 3) "a={a}" X"b={b}"
> > 4) F"a={a}" F"b={b}"
> > 5) F"a={a}" "b={b}"
> > 6) "a={a}" F"b={b}"
> > 7) F"a={a}" X"b={b}"
> > 8) X"a={a}" F"b={b}"

> Deviations from the pattern shown in the table in are likely to be considered surprising so should come with strong motivation.
> That table suggests that 1-6 be well-formed, that each member of the sets of 1-3 and 4-6 have the same meaning, and that 7-8 are ill-formed.

OK, well I think 1, 2, 4, and 5 are no problem to handle.

But 3 and 6 are... annoying. Since the preprocessor is only doing one pass, and there could be N number of regular string-literals before an F"" or X"" or neither, it might be untenable to have to peek ahead every time just to handle the ultra-rare case that it ends up being an f/x-string.

But I'll put something in the next rev to try to justify why supporting 3 and 6 isn't absolutely necessary.

-hadriel



Juniper Public

Received on 2023-10-19 08:27:08