C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [Std-Proposals] Re: condexpr: new syntax for preprocessor conditional inclusion

From: Michael Levine <melevine45_at_[hidden]>
Date: Wed, 14 Dec 2022 21:24:23 -0500
>
>
> Message: 1
> Date: Tue, 13 Dec 2022 08:21:35 +0100
> From: Peter Olsson <dataapa_at_[hidden]>
> To: std-proposals_at_[hidden]
> Subject: Re: [std-proposals] condexpr: new syntax for preprocessor
> conditional inclusion
> Message-ID:
> <
> CADfZiqtzsNZRb-+tiP-cnZqQ6izBDOfdN1nAEe5NQdVLjWWtNQ_at_[hidden]>
> Content-Type: text/plain; charset="UTF-8"
>
> >The syntax looks more like standard C++ code and less like preprocessor
> directives
>
> Is this an advantage or a disadvantage?
>
Personally I view it as an advantage from a user experience perspective,
but I understand that it is a surface level change, not a functionality
change.

> If I understand your proposal correctly, it's still a preprocessor
> directive but it disguises itself as normal C++ code. Preprocessor
> code and normal C++ code are essentially two independent languages.
> The way it works at the moment is that the preprocessor runs first
> (without it having to care about scopes or other C++ rules). The
> actual C++ code is not parsed until after the preprocessor has
> finished. Since they are so different I wonder if it's not a good
> thing that they have different syntax.
>
I agree that they are two separate languages, but those two languages
inhabit the same source files, and they intermingle. Because of this, I
think that a common syntax is helpful for improving user experience by
reducing the need to change your frame of reference given that the code can
now look the same regardless of it is preprocessor code or regular C++
code. I think similar discoverability is possible given that you can
easily search for `condexpr` in your codebase to find where this is
happening in the code. Then again, this is a proposal to gauge interest in
whether this is worth turning into a more formal proposal or not based on
the feedback I get here from the mailing list members, so I definitely
appreciate the feedback!

>
> ------------------------------
>
> Subject: Digest Footer
>
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
>
> ------------------------------
>
> End of Std-Proposals Digest, Vol 45, Issue 18
> *********************************************
>

Received on 2022-12-15 02:24:36