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

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Sun Aug 26 14:32:55 CEST 2012


Marco van de Voort wrote:
> 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 ?

I admit that I was thinking of the internal implementation, and was 
wondering whether there was any scope for merging string support with 
some of the things that have been grafted onto the language since 
(classes, interfaces and so on).

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list