[fpc-devel] Modernising Pascal

Jamie McCracken jamie-junk at blueyonder.co.uk
Wed Feb 23 15:43:06 CET 2005


Marco van de Voort wrote:
>>My mistake it actually avoids initialising the loop variable rather than 
>>not declaring it:
>>
>>for i in myarray do
>>   myarray[i] := 0;
>>
>>as opposed to
>>
>>for i := low(myarray) to high (myarray) do
>>    myarray[i] := 0;
>>
>>
>>I think the for..in is much clearer and more compact (it works for sets, 
>>arrays and other enumerated types)
> 
> 
> The constructs are not that frequent, so typing is not limited. I do not agree on
> the "clearer" part also.
> 
>>From low to high is more clear than IN, since that says nothing about order.


Well for..in is not a replacement for the conventional For syntax in all 
circumstances but nevertheless it is a convenience to have (a 
performance advantage as well perhaps?).

If FPC is committed to Delphi compatibility then it surely must add this 
at some point?

jamie.



> 
> 
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 
> 





More information about the fpc-devel mailing list