-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeneratedRegex attribute #95
Comments
It looks like this is not as easy. Maybe even impossible. Even if you provide Even if you could get the compiler to generate the source code, it would have may compilation errors. From a quick look there are at least the following additional things missing for the generated code:
|
Sounds like a long shot. No worries. |
In fact I suppose you really do not have to replicate also the performances of that Attribute. What's needed is just a polyfill that will write the code and inside the code will call the constructor for the standard regex. Like that the code will cross compile correctly. |
Description (optional)
Support for
[GeneratedRegex]
attribute. MS DocsRationale
This is the new .Net 8 way of having static readonly regexes in code:
Prior to .Net 8, this is required:
which is arguably cleaner, but it means that regex table lookups are performed at runtime instead of at compile time. (I expect my usage isn't an ideal example.)
Proposed API
No proposal
Drawbacks
None
Alternatives
None
Other thoughts
None.
The text was updated successfully, but these errors were encountered: