On 9/10/08, Marco van de Voort <[EMAIL PROTECTED]> wrote: > > Like everybody, I have read GOF several times, and even got some of the > successor books.
I don't think anybody has read GOF only once. :-) > The problem is how it applies to strings, and how they can be more > memory saving than a straight array of 16-bit values which are > copy-on-write. I think for a good code example of this, have a look at Java's Document class. It's not exactly what I'm talking about, but it's got the idea. The Document class forms the basic storing medium of all their text based components - from a simple TextEdit, TextArea to complex rich text documents. So it scales well. Each character can have individual characteristics set. Storage down to character level. Similar to what I am suggesting with the Flyweight pattern - characters of a string with encoding information. The Document class also uses an internal gapped buffer implementation to store it's content - apparently good for performance. Again something like this could be used in the "character pool" manager object - though I'm not 100% sure. Please note, this is just a thought. I haven't written any Object Pascal code implementing something like this - to prove the concept. I simply know the Flyweight pattern and it seems to be a possible option. Remember, Unicode support is much more that simply storing and displaying text. You have various encodings, RTL or LTR direction etc. I can't see how a simple type can keep track of all such information - but then, I don't know the internals of FPC either. ;-) Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel