[fpc-devel] Unicode and UTF8String

Sergei Gorelkin sergei_gorelkin at mail.ru
Tue Dec 2 11:21:17 CET 2008


Michael Schnell wrote:
> 
>> The more I think about it the more I like this solution. I think it's
>> better then the previous idea of a string with encode information
>> inside it.
>>   
> Would Lazarus be able to follow ?
> 
> Do you think it's possible to have the compiler take care of any 
> necessary conversions automatically ?
> 
For me, these attempts to make compiler do everything automatically sound
like getting yet another typing saver. The situation is already dangerously
close to "write once, debug forever". Recently (after Lazarus 0.9.26 
release)
I had encountered some cases when a trivial function call resulted in a 
couple
of conversions inserted silently and resulting outcome could be 
explained only
by tracing it or looking at the assembler code.
Another example is issue #11327. Initially I perceived it as a code 
generation issue, but after digging in it was clear that it's caused by 
first choosing an incorrect overloaded function, then inlining it, then 
attempting to optimize. There are already at least 17 overloaded Pos() 
functions, and the compiler simply gets lost between them. That issue is 
likely to be fixed, but the fix will be for the consequences of the 
problem, not for its origin.

Making the conversions automatic does not make the language clean, 
instead it hides the potential errors and author's intentions. Moreover, 
it forces anyone to (implicitly) use these conversions, even those who 
don't need it.

A notable fact is also that while all these endless speech about "lack 
of Unicode support in compiler", nearly all well-known Unicode 
processing software is written in languages that have no built-in 
support not only for Unicode, but for the strings itself.

Regards,
Sergei



More information about the fpc-devel mailing list