3 ms·
Great examples. Is source generation becoming "trendy"? Microsoft have recently added more of it to C#, in order to support their AOT efforts. It's a bit infra
by pjc50 3y ago
Great examples.
Is source generation becoming "trendy"? Microsoft have recently added more of it to C#, in order to support their AOT efforts. It's a bit infrastructure-heavy as it seems to be intended for point support for specific things, rather than a general purpose "write code to generate code" tool. But I wonder if there would be a market for such a thing. The architecture currently does not allow you to edit user source code, just add more code. I.e. it's not a preprocessor, it just has readonly access to the AST.
e.g. the regex generator https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-source-generators https://learn.microsoft.com/en-us/dotnet/standard/base-types...
(Reference blog post https://andrewlock.net/creating-a-source-generator-part-1-creating-an-incremental-source-generator/ https://andrewlock.net/creating-a-source-generator-part-1-cr... )
- humanrebar 3y agoI expect wider convergence on better build tools like CMake has made it relatively easier to perform custom build time logic like code generation without disrupting consumers of projects by changing or otherwise adding complexity to the build process.