Dayuxiaoshui commented on issue #350:
URL: https://github.com/apache/tvm-ffi/issues/350#issuecomment-3748791981

   @tqchen We understand this requirement. While the current immutable + COW 
design of Array provides benefits for unified tuple/map handling, there's a 
clear need for controlled mutability. We propose adding __setitem__ at the 
Python layer leveraging the existing COW mechanism, exposing ArraySetItem via 
FFI. This maintains backward compatibility (arrays remain immutable by default) 
while enabling arr[i] = value syntax. When the array has a unique reference, 
modifications happen in-place; multiple references trigger COW. The 
implementation is added to src/ffi/container.cc and 
python/tvm_ffi/container.py, ready to use. This approach preserves the semantic 
benefits of immutability while providing flexible mutability when needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to