[Python-Dev] pre-PEP: The Safe Buffer Interface

Neil Hodgson nhodgson@bigpond.net.au
Wed, 31 Jul 2002 12:12:31 +1000


Thomas Heller:

> In plain text:
> Provide a method which returns a 'view' into your object's
> buffer after locking the object. The view holds a reference
> to object, the objects is unlocked and decref'd when the
> view is destroyed.

   Yes, this handles the situation. However I see some problems here:
1 Explicit resource release, such as closing files, is easier to understand
and debug than implicit ref-count exhaustion.
2 On platforms such as .NET and the JVM, the view object will live for an
indeterminate time, prohibiting resizes until the VM decides to garbage
collect. While the JVM can not return pointers, and so may seem to not be a
candidate for this interface, it can return array references.
3 More complex implementation requiring a secondary view object.

   Neil