[fpc-devel] TBytes

Michael Schnell mschnell at lumino.de
Tue Feb 28 08:57:42 CET 2012


On 02/28/2012 07:29 AM, Martin Schreiber wrote:
>
> Because of Delphi compatibility and code cleanness.
I see: The "Unicode Threat" that makes "String" a moving target, forcing 
the poor "String" type to be "visible Text" i.e. holding a (somehow) 
known encoding of its binary content.

Of course I do see both aspects: GUI programmers will hope that 
"strings" are just printable and thus the name of the "somehow encoded" 
type should stay "String", while technically, a String is just a 
decently managed sequence of "something".

Thus to me it's clear that a decent compiler should provide both: one or 
more types for appropriately encoded text and one or more types for 
sequences of binary objects. that both should be easily usable and 
provide fast operation as similar as possible to the legacy String 
handling.

> Often we need to combine buffer data from binary pieces and character 
> data/strings.
>
Obviously.

So why not define decent types like "ByteString", "WordString", 
"DWordString", (maybe CharString, PointerString or whatever, too) 
allowing for the legacy string operations in an appropriately overloaded 
way ?

-Michael



More information about the fpc-devel mailing list