[fpc-devel] Unicode and UTF8String
fpc at mfriebe.de
Mon Dec 1 23:51:46 CET 2008
Mattias Gaertner wrote:
>>>> Also it would be nice (so I do not know how) not to have to
>>>> duplicate code, in order to archive this. Something like generics,
>>> The goal of RTLString is to avoid duplicate code in the RTL.
>> Yes I acknowledged that this would be a problem. And also RTLString
>> has the benefit, of allowing unicode fpc to be available far earlier
>> than it would otherwise.
>> The question remains, could it then be extended/optimized? Maybe a
>> generic like template (for functions, instead of objects)? Which
>> needs to be written only once, and the will be specialized for each
>> string type?
> I wonder, how many are there that really need this?
> Can you estimate?
You mean how many rttl functions would benefit. I do not know. But I do
think it's the wrong question.
In order to do it you would want something like function-templates
(generics equivalent for functions).
I do not believe such a template system would be developped for the sole
purpose of doing the above rtl work.
If however such a template system would be implemented anyway (because
it would benefit everyone in the same way generics do (actually I never
checked: can generics do simple functions or only classes?)), so if it
was there, then why not use it for the rtl too? In such a scenario does
it matter if you optimize 5 or 5000 functions?
More information about the fpc-devel