Description
I was hoping to clarify what your long-term goal is for memory management. #150 suggests that you eventually want to add a =sink
operator, but that seems to conflict with the idea of using reference semantics. You had toyed with moving away from that (#157) but ultimately decided against it.
Your current approach does seem to conflict with the idiomatic way of doing things in Nim and makes it difficult, verging on meaningless, to use sink
/lent
annotations with custom containing a Tensor. It would seem to me that the most idiomatic way to handle this in Nim would be to make Tensors use value semantics by default, using Nim's =destroy
operator for destruction and =sink
operator for optimisation. If a user then needs reference semantics then they can just use a ref Tensor
type.
Of course, I fully appreciate that this would be a significant (and breaking) change, so I don't expect you to suddenly make it on account of this feature request. Still, I thought it was worth raising.