Open martinwicke opened 10 years ago
There's no difference between Array and UntypedArray in this regard. The main disadvantage of making Array do this is that destructors won't be called until the entire array is destroyed, since when you resize there might be another array sharing memory. Also, it would be nice to do this after the xdress conversion and make sure it works well in that context (it should, since xdress can make custom dtypes).
I guess destructors shouldn't be called until the objects are actually destroyed -- which means that you may clear one array, but the objects live on because someone else still uses that memory (and the objects in there). This may be confusing in case you expect the destructors to be called, but I think it's fine, we just have to be careful to make sure the last person to own an array properly calls the destructors.
But agreed, no urgency to this, should wait until after xdress in place.
It would be really nice. For Array and Buffer that should be rather easy.
For UntypedArray we could (on construction) lift the constructor, destructor, operator=, etc. into generic function pointers and store them, and use them appropriately.