Open Guiorgy opened 4 months ago
For most methods this will work...
Even if it's only 70%, it would still substantially reduce the maintenance burden.
Also, when I say the generator should replace Span<x>
with ReadOnlySpan<x>
, that is only the default behavior. I plan to make the attribute take a params array of regex find and replace patterns optionally, so we can hopefully make it work with most of the codebase.
We should create a source generator that takes the source for
Span<T>
and replaces occurrences ofSpan<x>
withReadOnlySpan<x>
. Since most of the source for the two is the same, this should simplify maintenance, and reduce the risk of mistakes where one forgets to update the implementation of one after changing it for the other.Note: Replacing
ReadOnlySpan<x>
withSpan<T>
is not advised, sinceReadOnlySpan<T>
implementations may also accept aReadOnlySpan
for a different purpose that should remain as aReadOnlySpan
in theSpan<T>
implementation, for example:delimiter
is aReadOnlySpan<T>
in both cases.PS. Add this to the backlog for now, I'll get to it after the current 2 PRs are dealt with.