Repository navigation
C#: compile-time gate for scalar AsSpan() (pin welder-csharp unmanaged-constraint) - #7
Merged
Merged
Conversation
…is now a compile error welder-csharp da87061 moves the non-generic Vector<T>/FixedArray<T> AsSpan() from an instance method to a `where T : unmanaged` extension: call sites are unchanged for scalar/enum elements, but the record- and nested-element calls that used to throw at runtime (the AlphaMaps report) no longer compile and never appear in IntelliSense. AsSpan<TData>() keeps its runtime size gate; AsDataSpan() stays the safe bulk spelling. Binary-breaking on the managed side (instance -> extension), so the next release wants a version bump note. Test: a scalar vector still spans zero-copy through the extension, and reflection confirms no non-generic instance AsSpan remains to bind misuse to. Guide: the maps page now states the compile-time gate and the AlphaMaps indexing idiom. dotnet test 36/36. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pins skarndev/welder-csharp#7: the non-generic
AsSpan()becomes awhere T : unmanagedextension, so calling it on a record- or nested-container-element vector (e.g.chunk.AlphaMaps.AsSpan()) is a compile error instead of a runtime throw. Scalar call sites are unchanged.Adds a test (scalar span works through the extension; no non-generic instance
AsSpanremains) and a guide note with theAlphaMaps[i].AsSpan()idiom.Binary-breaking on the managed side (instance → extension); flag it in the next release notes.
Merge after the welder-csharp PR; the pin already points at its head.
🤖 Generated with Claude Code