Date: Thu, 26 Oct 2023 11:55:39 +0200
Niall,
thanks for reaching out to WG14!
on Wed, 25 Oct 2023 19:34:56 +0000 you (Niall Douglas via Liaison
<liaison_at_[hidden]>) wrote:
> Dear a subset of WG14,
>
> I've been asked to see what would be the general WG14 feelings
> towards an extension of the C preprocessor to enable implementation
> of F-strings. Here is the C++ focused draft paper:
>
> http://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/hadrielk/cpp-proposals/main/f-string/f-string-r2.bs#c-usage
Interesting.
But before we go into the specific details or goals that this paper
tries to achieve (which are all interesting by themselves) I would
like to take back a step concerning syntax of the preprocessor.
I don't know how this exactly works in C++, but in C prefixes of
strings and suffixes of number constructs are not symmetrical. Whereas
for suffixes basically any *identifier* glued to a number would
survive preprocessing, for prefixes the only allowed currently are
`L`, `u`, `u8` and `U`.
This caused some problems when C introduced `U` because previously
`U"something"` was read by the preprocessor as two tokens, an
identifier followed by a string. This could be valid in some cases
where there was a macro `U` that did some fancy stuff, and so some
code changed semantics from one version of C to the next.
So maybe, before thinking of special cases like in the proposed paper,
we should first think of widening the notion of string in the
preprocessor, gluing any directly preceding identifier into the same
token. I wouldn't expect this to be very controversial, but this would
then give us the grounds to come up with a particular meaning for any
of these. I think this would be a good move for ensuring compatibility
between C and C++, anyhow.
BTW, I was think of using such things for other purposes, namely a
small `x` prefix for binary strings (`x"o\xab"` otherwise interpreted
as usual but of type `unsigned char const[]`) and `B` for base64
encoded binary strings.
Thanks
Jₑₙₛ
thanks for reaching out to WG14!
on Wed, 25 Oct 2023 19:34:56 +0000 you (Niall Douglas via Liaison
<liaison_at_[hidden]>) wrote:
> Dear a subset of WG14,
>
> I've been asked to see what would be the general WG14 feelings
> towards an extension of the C preprocessor to enable implementation
> of F-strings. Here is the C++ focused draft paper:
>
> http://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/hadrielk/cpp-proposals/main/f-string/f-string-r2.bs#c-usage
Interesting.
But before we go into the specific details or goals that this paper
tries to achieve (which are all interesting by themselves) I would
like to take back a step concerning syntax of the preprocessor.
I don't know how this exactly works in C++, but in C prefixes of
strings and suffixes of number constructs are not symmetrical. Whereas
for suffixes basically any *identifier* glued to a number would
survive preprocessing, for prefixes the only allowed currently are
`L`, `u`, `u8` and `U`.
This caused some problems when C introduced `U` because previously
`U"something"` was read by the preprocessor as two tokens, an
identifier followed by a string. This could be valid in some cases
where there was a macro `U` that did some fancy stuff, and so some
code changed semantics from one version of C to the next.
So maybe, before thinking of special cases like in the proposed paper,
we should first think of widening the notion of string in the
preprocessor, gluing any directly preceding identifier into the same
token. I wouldn't expect this to be very controversial, but this would
then give us the grounds to come up with a particular meaning for any
of these. I think this would be a good move for ensuring compatibility
between C and C++, anyhow.
BTW, I was think of using such things for other purposes, namely a
small `x` prefix for binary strings (`x"o\xab"` otherwise interpreted
as usual but of type `unsigned char const[]`) and `B` for base64
encoded binary strings.
Thanks
Jₑₙₛ
-- :: ICube :::::::::::::::::::::::::::::: deputy director :: :: Université de Strasbourg :::::::::::::::::::::: ICPS :: :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus :: :: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 :: :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Received on 2023-10-26 09:55:43