[fpc-devel] Unicodestring branch, please test and help fixing

peter green plugwash at p10link.net
Tue Sep 9 22:25:14 CEST 2008


> I fully agree with you. I would like the object oriented way of strings
> also - but I stopped asking for that ;) There are a lot of advantages
> over the small amount of disadvantages.
Which object orientated way of doing strings?

As I see it there are three main ways of doing variable length strings.

1: Let the programmer manage the memory lifetime (the C way), this is 
tedious, error prone and generally results in lots of unnessacery 
copying of strings since it is easier for the programmer to have 
seperate copies owned by different objects than to
manage shared strings.
2: Use immutable objects and let the garbage collector clean them up 
(the java way), this works but since the strings are immutable they must 
be copied to make any modification. It also relies on a garbage 
collector will all it's associated problems.
3: Use an automatic reference counting system either implemented in the 
compiler (the delphi/fpc way) or implemented using a very powerfull 
operator overloading system (the C++ way, last I checked freepascal did 
not have sufficiant operator overloading capabilities to implement this)





More information about the fpc-devel mailing list