Re:Julia as a unifying end-to-end workflow language on the F...
by renox on Sunday November 19, 2023 @07:08AM
(#38331895)
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).
[ Parent
| on HN ]
Re:Julia as a unifying end-to-end workflow language on the F...
by eigenspace on Sunday November 19, 2023 @07:30AM
(#38332056)
They 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.