Well you're right there, but inheriting from abstract array can't do magic. What you'd be asking for is, that inheriting from AbstractArray does some magic which can deal with any thinkable array type people can come up with. On the other hand, just defining 4-5 functions is not that much and you can then get quite a few functions for free than. Something what I've been wanting though is, that if the type is really pretty much the same just with another name, it should be possible to inherit all the functions. I opened an issue some time ago about this: https://github.com/JuliaLang/julia/issues/9821
As you can see, it's quite tricky to solve this cleanly. Am Samstag, 25. April 2015 13:50:52 UTC+2 schrieb Marcus Appelros: > > Consider the definitions: > > type Cubes<:AbstractArray > end > sum(cubes::Cubes)=sum(convert(Array,cubes).^3) > > Is it possible to make this work? To create a custom array that has > indexing and all at inception? Looked up the definition of Array and it is > in the commented section on types implemented in C, its constructor is a > ccall, if it isn't possible in pure julia would it be possible with C-code > that doesn't prompt a rebuild? >
