[fpc-pascal] fcl-passrc errors

Michael Van Canneyt michael at freepascal.org
Wed Oct 16 00:13:03 CEST 2019



On Tue, 15 Oct 2019, Ryan Joseph wrote:

>
>
>> On Oct 15, 2019, at 5:26 PM, Benito van der Zander <benito at benibela.de> wrote:
>> 
>> you could do
>> 
>> var
>>   it: pointer;
>>   obj: TObject absolute it;
>> begin
>>   for it in list do
>>     begin
>>       // continue on like before using “obj” instead of “it"
>>     end;
>> 
>
> That is a clever solution but it’s basically a sneaky trick around the
> compilers excessively strict typing.  The programmer knows the correct
> type but there’s no way to tell that to the for loop.

Ehm... I can hardly believe my eyes...

Of course there is: make the list the correct type. No typecasting needed then.

One could argue that it's your own "laziness" in correct typing that forces you to use
"tricks" further down the line.

Then blaming the need for these tricks on the compiler's 'excessively strict typing' 
is simply the world turned upside down.

Michael.


More information about the fpc-pascal mailing list