C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [P2758] Emitting messages at compile time

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 25 Oct 2024 16:07:34 +0300
On Fri, 25 Oct 2024 at 05:16, Herb Sutter via SG15
<sg15_at_[hidden]> wrote:
> So that no good deed goes unpunished 😊 I'll warn you that I intend to be greedy: Some of us will be asking for general compile-time I/O, or at least O (output), in a consteval function. For example, to create a file that contains:
>
> JSON
> C++ code
> another language’s code, such as to generate an FFI binding to call the C++ source (e.g., to emit a .java file that defines a Java `interface` that can be bound to a C++ type)
> even binary output files (e.g., .winmd files needed to describe C++ types to the Windows WinRT subsystem, a necessary thing for reflection+generation to replace special/extended compilers needed to generate that for C++ types today)
>
>
>
> Of course, all the usual security controls would need to apply, like sandboxing and controlling what directories can be written to.

I, however, am not at all convinced that I am going to join this
greedy posse any time soon. I can write those code generators
with rich enough reflection facilities as long as there's some
half-decent ways to save some of the reflection results
for run-time use. To what extent we have those already is a bit
unclear, but define_static_string() is along the right lines.

Received on 2024-10-25 13:07:48