[fpc-devel] Unicodestring branch, please test and help fixing
Thaddy
thaddy at thaddy.nl
Tue Sep 9 22:30:43 CEST 2008
peter green schreef:
>
>> 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)
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.169 / Virus Database: 270.6.19/1660 - Release Date: 9/8/2008 6:39 PM
>
>
Check again...
But it is still a bad idea (like c++) How does one recognize a deep vs
shallow string copy f.e. This is realy basic..... And rather uninformed
as well..
More information about the fpc-devel
mailing list