Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Nov 29, 2025

Feature request by #25826

This PR aims to decouple the auto_str() function from individual backend generators and move it to the frontend. This way, each backend can remove its own auto_str() implementation.
The general approach is to introduce a new phase, gen_auto_fn() in the builder—after the checker and before code generation. This phase leverages the results from the checker and markused to identify which types require the auto_str() function. It then manually creates these virtual functions, processes them using parser.parse_text(), and performs checks via check(). The output is subsequently passed to the respective backends for code generation.

Currently, only the generation of auto_str() for structs is supported. Future extensions may include support for other str() functions, with the ultimate goal of fully migrating this functionality to the frontend.

@kbkpbot kbkpbot marked this pull request as draft November 29, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant