Use type annotations for `meta_array` information
Array takes a meta_array argument in its constructor. This argument determines the array class instance to return when data is requested. E.g.,
x = Array(meta_array=MyArray, ...)
x[0] # returns an instance of MyArray
meta_array is type information, but it's not being encoded using type annotations, which means static analyzers have no clue about it. An alternative that would use type annotations, would be to make Array generic with respect to the returned array type, e.g.
x = Array[myArray](...)
x[0] # type checker can tell that this will be an instance of `myArray`
I understand that dask uses meta_array for the same purpose. The same argument applies there as well?
This is based on comments made in #1484
cc @madsbk
after taking a glance at the kind of changes this would require, it looks challenging to say the least. A lot of functions in the codebase combine creating an array in storage (init_array) with accessing that array (Array). meta_array as an argument works fine in these cases, but the generic typing approach would not. One solution would be to make all these create + access routines class methods bound to Array? But this would be a pretty big change to creation API. That being said, if there's sufficient demand for type safety from the community, this could be a viable strategy.