Re: Jython buffer protocol
Jeff Allen <[email protected]>
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <[email protected]> |
Jeff Allen On 06/08/2014 02:28, Stefan Richthofer wrote: > Jeff, > > I just quickly scanned the changes and everything looks fine as far as I see. PyByteArray and BaseBytes may need adjustments too (on this occasion remember to add resizeCheck() in irepeat). Thanks for looking that over. I was rather asking whether the use case was served adequately by the addition of PyBUF.AS_ARRAY, hasArray() and getNIOByteBuffer(), since you obviously have a clear idea of it. I took a second/third look but didn't find anything to change in BaseBytes and PyByteArray: when arguments objects have the Buffer API they are accessed through the abstract API (not as byte[]). PyByteArray obviously can support AS_ARRAY, and that seems to be covered in SimpleBuffer. I fixed the irepeat bug in the previous change set: it's a distinct issue, so it gets its own change set. Thanks for spotting. > I know there would be careful thinking needed on how to design such intermediate layer and it would be a drastic change of the current API. I just wanted to make you aware of this idea. Maybe one could approach this in Jython 3 or so, or work out a minimal implementation of it, being open for more advanced use in the future. > I think it would make sense to have a layer below BaseBytes that contained all those mechanisms that work without assuming a byte[] storage. This would help you implement PyBuffer in an object unable to export a byte[]. That wouldn't change the API and is likely harmless to efficiency. But more radical ideas, I agree, need more careful thought. (The present design has had a lot of thought.) Jeff ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk