fsharp / fsharp/fslang-suggestions
Support Source Generators
- Dominant language
- No language data
- Stars
- 373
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
# 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 obviously already been taken (e.g. "Make F# untyped") then please don't submit it.
Please tick all that apply:
* [x] This is not a breaking change to the F# language design
* [x] I or my company would be willing to help implement and/or test this
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the 131-comment discussion on this issue, especially the proposed two-pass compiler model and its performance concerns. No source files, tests, or compiler entry points are identified; the work is not ready for a first contribution until the design and implementation scope are agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, fsharp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100