[fpc-devel] But what /is/ a string?

Anton Kavalenka anton.k at tut.by
Fri Aug 24 15:56:03 CEST 2012


On 24.08.2012 16:14, Mark Morgan Lloyd wrote:
> I wonder if I could ask a silly question. My understanding is that 
> strings are pretty much unique in not being objects, and relying on a 
> fair amount of compiler and RTL wizardry to handle reference counting 
> etc.
>
> I note somebody at Embarcadero blogging [Paraphrase follows] "Delphi 
> is being enhanced by adding memory management features such as 
> reference counting".
>
> Would there be any advantage in reimplementing strings as a tree of 
> classes, with the compiler doing appropriate things to change e.g. 
> Pos() into String.Pos(), UnicodeString.Pos() or whatever as appropriate?
>
String is the automatic reference-counted object.

But FPC team always denies this :))) citing Pascal standards of passed 
century.

Btw

var
  s:utf8string;
  ws:UnicodeString;

  i:=s.length();

  ws:=s.convert(UTF-16);


much more readable and causes less headache.

regards,
Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120824/86cc2f6d/attachment.html>


More information about the fpc-devel mailing list