C++ Logo

std-proposals

Advanced search

Re: [std-proposals] History and Context of Injection

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Sat, 16 Aug 2025 18:14:08 +0200
On 16.08.25 13:49, Omer Rosler via Std-Proposals wrote:
> Hello all,
>
> I want to help make injection happen for C++29 and would really appreciate some context and history before delving in.
> I read online that the favoured approach today is of token sequences from P3294R2 <http://wg21.link/P3294R2>, instead of fragments from P2237R0 <http://wg21.link/P2237R0>.
>
> I understand the token sequences approach is very powerful, but it is not ideal due to it being unstructured.
>
> What happened to the fragments approach? It looked very promising. I found only two technical discussions on the subject:
> 1. The comparison part of P3294R3. Specifically the problem described in section 4.11.
> 2. Discussions <https://lists.isocpp.org/sg7/2020/10/0042.php> on the SG7 reflector from 2020 about P2237 (in which it seems fragments is prefered).
>
> Note I am not on the committee yet, I don't have access to the wiki.
>
> From my understanding, the main technical problem with fragments is "the composition of fragments is awkward because we can only inject valid fragments".

Right, and that's a major problem. C++ has a lot of syntax. The inspection API
we already have is fairly large, and we'd need an even bigger API surface for
doing fragment injection, it seems.

> If this is the only major issue, I think it can be solved without abandoning the approach completely. I can elaborate if desired (and write a paper if this is deemed valuable).

Care to elaborate the main idea here before investing into a paper?

Thanks,
Jens

Received on 2025-08-16 16:14:13