Metaprogramming (Source generators) #3689
Replies: 3 comments 4 replies
-
Are you suggesting Gleam could have something similar? If so, what might it look like in Gleam, how would it work, and how would it be implemented? |
Beta Was this translation helpful? Give feedback.
-
First all you need some thing like .net roslyn api where you can iterate throw syntax tree, syntax nodes and syntax tokens. So in .net with c# you can force standards and architecture. And also you can write live documentation for code. Source generators work due to roslyn api. I think it would the best tool for tooling |
Beta Was this translation helpful? Give feedback.
-
https://github.com/Pragrammist/gleam_source_generators_concept |
Beta Was this translation helpful? Give feedback.
-
.NET 5+ (the .NET Framework is for Windows only, but .NET is open source and cross-platform) has source generators that allow you to create C# code while it compiles, and it's open to anyone.
In the left section, there is a chapter titled "The .NET Compiler Platform SDK," which will help you understand it. I think it is possible to implement a functional gleam approach. However, it needs to be well documented and simple enough for people to use.
https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview
Beta Was this translation helpful? Give feedback.
All reactions