3 ms·
I'd expect the compiler not to let you to pass a 0-based array to a library function expecting a 1-based array. I'm pretty sure that's how it worked with Visual
by wizofaus 4y ago
I'd expect the compiler not to let you to pass a 0-based array to a library function expecting a 1-based array. I'm pretty sure that's how it worked with Visual Basic, which was the only language I ever used such a feature in.
- btilly 4y agoYou are demanding a lot from the type system. Search for OffsetArrays in https://yuri.is/not-julia/ https://yuri.is/not-julia/ for practical problems encountered in trying to make this feature work in a language whose compiler does try to be smart.
- ChrisRackauckas 4y agoThe type system does tell you if this is used. `::OffsetArray`.
- btilly 4y agoYes, but did the programmer tell the type system that they are expecting an OffsetArray, they have tested it, and it will work correctly? The existence of a mechanism does not guarantee its correct use. As that link demonstrates.