I like your approach. I’d just try to find a way not to force de field name as data
.
Maybe instead of calling a.data
, using a function data(a)
? Then you’d just have to create one method for the subtype that would specift which field to use as data: data(b::MyArray) = b.whichevernameichose
.
Yes, this is definitely a good idea. I wonder if it would be worth making a small package out of this, I find myself wrapping arrays quite often and having the possibility to get a fully functional new AbstractArray without any additional method definitions might help for shorter code.
1 Like