IssueRaiser

Support Source Generators

# Support Source Generators Add support similar to C# Source Generators The idea is to execute the compiler in two passes: 1. **Pass 1** Parse and type check the project code (the type check may be optional as it will contain errors) 2. Send that information to Source Generators that output new code files or syntax trees 3. **Pass 2** Combine all code, type check, emit The existing ways of approaching this problem in F# are: 1. TypeProviders which take specialized knowledge to author. 2. Custom build steps to emit code ## Pros and Cons The advantages of making this adjustment to F# are an easy form of meta programming. It's basically all the benefits of type providers without the complexity. The disadvantages are the repetition of a feature and the compiler performance penalty of executing the type checker twice when this feature is used. ## Extra information Estimated cost (XS, S, M, L, XL, XXL): XXXXL ## Affidavit (please submit!) Please tick this by placing a cross in the box: * [x] This is not a question (e.g. like one you might ask on [stackoverflow](http://stackoverflow.com)) and I have searched stackoverflow for discussions of this issue * [x] I have [searched both open and closed suggestions on this site](http://github.com/fsharp/fslang-suggestions/issues) and believe this is not a duplicate * [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obvi

Posted by praeclarum on Apr 29, 2020, 10:42 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

pricing (Software)

Support Source Generators

praeclarumApr 29, 2020, 10:42 PM

# Support Source Generators Add support similar to C# Source Generators The idea is to execute the compiler in two passes: 1. **Pass 1** Parse and type check the project code (the type check may be optional as it will contain errors) 2. Send that information to Source Generators that output new code files or syntax trees 3. **Pass 2** Combine all code, type check, emit The existing ways of approaching this problem in F# are: 1. TypeProviders which take specialized knowledge to author. 2. Custom build steps to emit code ## Pros and Cons The advantages of making this adjustment to F# are an easy form of meta programming. It's basically all the benefits of type providers without the complexity. The disadvantages are the repetition of a feature and the compiler performance penalty of executing the type checker twice when this feature is used. ## Extra information Estimated cost (XS, S, M, L, XL, XXL): XXXXL ## Affidavit (please submit!) Please tick this by placing a cross in the box: * [x] This is not a question (e.g. like one you might ask on [stackoverflow](http://stackoverflow.com)) and I have searched stackoverflow for discussions of this issue * [x] I have [searched both open and closed suggestions on this site](http://github.com/fsharp/fslang-suggestions/issues) and believe this is not a duplicate * [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obvi

Comments (0)

No comments yet. Start the discussion.

Comment on this issue