3 ms·
Couldn't this kind of things be caught by type checking? 1-indexed vectors should be different type than arbitrary offset vector (implicitly convertible in one
by renox 3y ago
Couldn't this kind of things be caught by type checking?
1-indexed vectors should be different type than arbitrary offset vector (implicitly convertible in one way only).
- eigenspace 3y agoThey are different types, but they share a common supertype (AbstractArray). AbstractArray includes thing like regular Array, and also a whole zoo of other array types (including OffsetArray). The problematic code was incorrectly saying it worked on any subtype of AbstractArray, but was actually written assuming that the arrays were 1-based which is an invalid assumption.