[fpc-devel] Some compiler changes...

Luiz Americo Pereira Camara pascalive at bol.com.br
Tue Jan 23 20:11:41 CET 2007


Daniƫl Mantione wrote:
> Op Tue, 23 Jan 2007, schreef Luiz Americo Pereira Camara:
>
>   
>> Ale? Katona wrote:
>>     
>>> I agree. I'm starting to feel sick of all the compat crap you guys put
>>> up with playing the bitch of delphi. The problem is that now delphi is
>>> the bitch of .net so I think wisest would be to implement 100% compat up
>>> to delphi 7 and be done with it. Then just document the fact and point
>>> people to mode objfpc and our new stuff.
>>>
>>>       
>> This makes me remenber of copying weird behaviors of Delphi. As an example see
>> the code:
>>
>> AList:=TStringList.Create;
>> with AList do
>> begin
>> writeln('Set a string with space (aaaa;bb bb;cccc) to DelimitedText');
>> DelimitedText:='aaaa;bb bb;cccc';
>> writeln('Count: ',Count);
>> writeln('Delimited text: ',DelimitedText);
>> writeln('Strings: ');
>> for i:= 0 to Count - 1 do
>>  writeln('  ',Strings[i]);
>>  Destroy;
>> end; 
>>
>> Output:
>> Set a string with space (aaaa;bb bb;cccc) to DelimitedText
>> Count: 4
>> Delimited text: aaaa;bb;bb;cccc
>> Strings:
>> aaaa
>> bb
>> bb
>> cccc
>>
>>
>> The space is used as a hardcoded delimiter being necessary to enclose with ".
>> This limits the use of DelimitedText as a generic approach since is necessary
>> to preprocess the strings being added though DelimitedText.
>>
>> The argument to keep such behavior is compatibility but there will be always
>> differences when porting code and the programmer must be aware. What is
>> necessary is to document the differences. So in resume i think that fpc must
>> not follow strictly Delphi, and in some situations, where appropriated, fpc
>> can/must do things different/better than Delphi.
>>     
>
> Yes, but unless it is clearly a Delphi bug, it is better to keep the 
> Delphi compatible procedure or class and write a new clean one. Wether 
> something is a bug or intended behaviour usually becomes clear after 
> reading the the documentation.
>   
Ok. Apart from the Delimiter issue, i've heard some complaints about the 
design of TStringList that would not be scalable etc (a quote of a email 
sent to fpc-devel below). Maybe is time to add to fpc a new class to 
store strings, fixing the design flaws? Anyone already has such a base?

Luiz
> Michael Van Canneyt wrote:
>   
>> > > The purpose of Customsearch is to sort the list once using a custom
>> > > sorting algorithm.
>>     
> > 
> > That reduces its usefulness, and why I said it's a broken design  :) .
>   
>
> Well, it fits with the rest of TStringList then  :-) 
>
> Seriously, I wouldn't bother using TStringList. It's position in the VCL and
> Delphi compat and its fundamental flaws make it too difficult to
> enhance/improve.
>
> (hinting on the scaling problems, the delimited functions always using space as a
> separator etc)
>
> Marco van de Voort
>   







More information about the fpc-devel mailing list