From: Moritz H. <mo...@gm...> - 2007-06-18 20:27:38
|
Hello, today I submitted a mutable buffer section class to ooRexx. I'd like to know if the approach I chose is open enough to fit all needs. What it is good for. While developing the serialization class I found out that using rexx strings may slow down applications. Using mutable buffers can be a way to compensate this, but as soon as there are many method invocations it gets harder to pass the buffer plus position descriptors. Based on this idea I started to implement a class that acts like a complete mutable buffer but maps all method invocations to an underlying buffer. The result of this is included in the patch (see subject). There is one major problem with this: Imagine there is a long buffer and there are several sections working on it. There will come a time where a section at the beginning of the buffer is asked to change its length. This may either be an append or insert command or a delete action. All of these have one thing in common: they change the length of the section, and the length of the underlying buffer. The result of this is that all sections following later will be shifted to a different position, making them invalid. A straight forward solution would be to track all sections that belong to a buffer. Sections notify the manager of a change in length and the manager updates all following sections. (This would require that no sections overlap, but the should not be done anyway...) A data structure could look like: buffers:.table (buffer b,list of sections) If section s notifies the manager to change length by m the manager would do the following: do over all sections after s belonging to b section~start += m What do you think? Should I implement this now although there are no weak references and manual clean up must be done? This requires applications to explicitly notify the manager to drop sections when they are not needed anymore. The reference to the buffer would be removed as soon as there are no sections available anymore. Moritz -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail |