My conclusion is - in accordance to what @Henrique_Becker has written - that the crucial problem is
eachindex
docstring. The issue is that IMHO we need to carefully review contracts that Base Julia functions provide to make sure they are precise and easy to understand for developers so that when they add methods to such functions they can correctly implement them. Unfortunately this task is quite hard to achieve in practice.
It would be great if Base Julia published both test fakes (e.g. subtypes of AbstractArray
which can be consumed by functions which expect an AbstractArray
, but which are carefully designed to satisfy only the assumptions laid out in the AbstractArray interface) and test suites (e.g. a function which consumes an AbstractArray
and checks that it satisfies the AbstractArray interface) for its interfaces – Invenia had a good blog post about this kind of thing a while back.