[fpc-devel] Unicode proceedings

Michael Schnell mschnell at lumino.de
Fri Nov 18 10:22:12 CET 2011


On 11/17/2011 02:44 PM, Sven Barth wrote:
>
> One could implement a similar type for something like this (maybe even 
> use the mentioned TBytes) and define operator overloads for it (at 
> least for "+").
>
Why should one do this, regarding that a normal string type provides 
exactly what very often is requested: reference counting, lazy copy, 
dynamic length, extracting single bytes at any location, finding a 
certain byte or sequence of bytes, concatenation, deletion of a number 
of bytes at a given position. proven functionality and performance.

OTOH some important feature that very often is necessary with byte 
buffers is lacking with strings: To do a FiFo you need a _fast_ deletion 
from position 1. AFAIK, here strings do a copy of the complete content. 
To avoid this, an implementation would require handling the content in 
chops and manage the appropriate pointers. Providing such a Type and the 
appropriate compiler magic (for reference counting and operations line 
'+' would be really nice. Regarding the current discussion this even 
might be a dedicated string type (additional to the "General" and the 
multiple "Strictly encoded" variants). Of course such a specialized FiFo 
aware type would perform worse than an ordinarily string type in most 
other operations.

-Michael



More information about the fpc-devel mailing list