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

Marco van de Voort marcov at stack.nl
Fri Aug 24 17:59:46 CEST 2012

In our previous episode, Mark Morgan Lloyd said:
> 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.

And copy on write, automatic conversions/type equivalence.
> I note somebody at Embarcadero blogging [Paraphrase follows] "Delphi is 
> being enhanced by adding memory management features such as reference 
> counting".

That's all what there is. There is simply not enough to comment on.

> Would there be any advantage in reimplementing strings as a tree of 
> classes,

A class _tree_ even? :-)

> with the compiler doing appropriate things to change e.g. Pos() into
> String.Pos(), UnicodeString.Pos() or whatever as appropriate?

What do you think the advantages and disadvantages would be? (and obviously
then, besides some minor superficial syntax change?

Are you talking about making them objects internally, or just OO like syntax
instead of function(x) based ?

More information about the fpc-devel mailing list