[fpc-devel] Feature announcement: Type helpers

Ludo Brands ludo.brands at free.fr
Wed Feb 6 14:26:39 CET 2013


On 02/06/2013 01:12 PM, Sven Barth wrote:
> Am 06.02.2013 12:13, schrieb Henry Vermaak:

>> Thanks for pointing out the advantages.  I can see the point, but can't
>> help to think that I'll be reading code like this soon:
>>
>> s := '(' + x.ToString + ', ' + y.ToString + ')';
>>
>> Instead of
>>
>> s := Format('(%d, %d)', [x, y]);
> I suppose there are quite some people (especially newbies ^^) who write
> it like this:
> 
> s := '(' + IntToStr(x) + ', ' + IntToStr(y) + ')';
> 
> And here I would prefer the "ToString" variant (but my personal favorit
> is the "Format" one :) )
> 

Funny to see that all these fans of a strongly typed pascal prefer
Format() that is using variants, has an undetermined number of
parameters, doesn't give the compiler any opportunity to check the types
used and causes runtime errors when a wrong type or a wrong number of
parameters is passed ;)

Ludo



More information about the fpc-devel mailing list