cpstrnew branch (was Re: [fpc-devel] Freepascal 2.4.0rc1 released)

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Nov 11 11:36:14 CET 2009

On 11 Nov 2009, at 11:04, Michael Schnell wrote:

> What about case sensitivity with "if str1=str2 then ..." ?

The "=" operator for strings has always performed a simply byte-wise  
comparison until now, and presumably keeps acting the same in Delphi  
2009 with the new UnicodeStrings. Custom string comparisons require  
helper routines (such CompareText and friends), because there are a  
lot of different options that you can require (numeric vs lexical vs  
raw byte comparisons, case sensitive/insensitive, ignoring diacritics  
or not, treating decomposed and composed code points the same or  
not, ...). You cannot shoehorn all of that on a single operator.

> Strings are a perfect tool to just store some values, disregarding any
> encoding. Something like dynamic arrays but with the benefit of
> reference counting

Dynamic arrays are reference counted.

> and using standard objects like TStringList.

It would also be useful if you could store strings into a set  
(transparent hash set!), but that does not mean that every possible  
data structure for every possible data type should be built into the  
language. There is no inherent reason why you cannot easily create  
tstringlist-like functionality for dynamic arrays.

> AFAIK, the recent Delphi provides a completely new object for that
> purpose, which I do think is not necessary at all, and braking a lot  
> of
> existing code.

I have not heard about this. Not to mention that changing strings into  
a hypothetical rawdwordstring would also break existing code, so I  
don't see how that's better or worse in that respect.


More information about the fpc-devel mailing list