New .NET 7 Regex Source Generator: Syntax too obtrusive #6509
-
The new feature is nice, but I believe it suffers from a very obtrusive syntax. Couldn't you make an attribute or keyword alone (e.g. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
The generator belongs to dotnet/runtime repo.
It can hardly be "switching". The code structure of using source generator and using constructor are fundamentally different. A method (or partial property, if it exists) is necessary to wrap the details. |
Beta Was this translation helpful? Give feedback.
-
I think it could be improved with the introduction of partial properties. since the method call might give the impression that there's computation going on. |
Beta Was this translation helpful? Give feedback.
The generator belongs to dotnet/runtime repo.
The syntax looks necessary to me.
It can hardly be "switching". The code structure of using source generator and using constructor are fundamentally different. A method (or partial property, if it exists) is necessary to wrap the details.