Skip to content

Source Generators #17

Open
Open
@Guiorgy

Description

@Guiorgy

We should create a source generator that takes the source for Span<T> and replaces occurrences of Span<x> with ReadOnlySpan<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> with Span<T> is not advised, since ReadOnlySpan<T> implementations may also accept a ReadOnlySpan for a different purpose that should remain as a ReadOnlySpan in the Span<T> implementation, for example:

public static SpanSplitSequenceEnumerator<T> Split<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> delimiter) where T : IEquatable<T>

public static SpanSplitSequenceEnumerator<T> Split<T>(this Span<T> span, ReadOnlySpan<T> delimiter) where T : IEquatable<T>

delimiter is a ReadOnlySpan<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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions