[fpc-pascal] Generic String Functions

Michael Schnell mschnell at lumino.de
Fri Feb 28 09:36:45 CET 2014


..Continuing the never ending discussion ...

[ In one ore more other threads here I showed that (IMHO) it would be 
most sensible (and in fact not performance killing (!) ) way out of the 
multiple (statically defined) "new" String types with different encoding 
(with auto-conversion) to additionally support a fully dynamically 
encoded string type (with auto-conversion) - which needs some compiler 
magic - and use same as the base type for TStrings and it's siblings. ]

The growing popularity of "Generics" might suggest to call this String 
encoding "Generic", too, (to easily tell it from the Delphi-introduced 
"Raw", and the dedicated encoding types).

Regarding arguments for it's usefulness I came across that the Lazarus 
API currently forces TStrings to be UTF8 encoded while Delphi currently 
forces TStrings to be UTF16 encoded. IMHO the only way to prevent 
disastrous compatibility problems is to do TStrings being 
"Generic"encoded and with that allow for decent portability for both.

-Michael



More information about the fpc-pascal mailing list