Replies: 3 comments 1 reply
-
Sounds like the purpose of interceptor. |
Beta Was this translation helpful? Give feedback.
-
If I understand you correctly, this sounds like something dotnet/csharplang#1028 could solve? |
Beta Was this translation helpful? Give feedback.
-
So that sounds like two distinct steps and one is actual runtime run. Source generator cannot do that. The only way to make it work would be to have separate tool (eg. command-line console project) that generates necessary data for extra optimization in format that can be consumed by source generator - which is basically c# code only AFAIK (so it could be a single file with just assembly attribute that has string parameter or something that SG can look up and extract to drive generation). But honestly at this point you might as well do full source-gen with roslyn or other tool, skipping SG entirely unless you already are halfway there with SG |
Beta Was this translation helpful? Give feedback.
-
Run the app for once, produce stuffs that's only producible after the app is running, and the stuffs are used for making release build more efficient.
For example, compiler might be unable to do some function fusion like turning 'a calls b calls c' to simply a call to a more efficient function, which I can produce by running my application and looking at the result
Usually there's a specification that was easy for me to build things, but specifications are complicated and I can flatten it out by computing the expression once and giving it a function that transform the result which is a function too to a more efficient function
Beta Was this translation helpful? Give feedback.
All reactions