Drop the AbstractNamedInteger <: Integer subtyping#172
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #172 +/- ##
==========================================
- Coverage 73.46% 73.44% -0.03%
==========================================
Files 21 21
Lines 1142 1141 -1
==========================================
- Hits 839 838 -1
Misses 303 303
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <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.
Summary
Makes
AbstractNamedIntegera standalone abstract type instead of<: Integer. A named integer is a tagged scalar, not a true integer: operations likei1 * i2fuse names rather than multiply cleanly, mixed named and unnamed arithmetic has no well-defined meaning, and inheritedIntegerfallbacks risk silently dropping the name. The type keeps the explicit integer-like surface it actually needs (equality, hashing, the arithmetic it supports, ordering,show).This also removes the named-to-plain-number conversion path (the
Numberconstructor andconvert) that let named and unnamed integers interoperate. That interoperation is what the standalone design deliberately drops, and aconvertthat silently discards the name is exactly the name loss being avoided. The one internal consumer, resolvingbeginandendto a plain index into_index, now reads the underlying value withdenamed, which is also how callers should get the plain integer from a named integer.The element-type constraints that disambiguate named-range indexing (the
BlockArraysgetindexmethods and the plain-Arrayindexing method) change from{<:Integer}to{<:AbstractNamedInteger}, since a named unit range's element type is a named integer, which is not anInteger.