[fpc-devel] Re: Testing for..in feature

Paul Ishenin ip at kmiac.ru
Thu Nov 5 05:39:17 CET 2009


Alexander Klenin wrote:

>> 2) skip any compiler code modifications since the next code still works and
>> outputs 5 numbers:
>> type T = (a1, b1=5);
>> var
>>  ch: T;
>> begin
>>  for ch in T do
>>    WriteLn(Ord(ch)); // <- note Ord() here
>> end
> 
> What are these numbers? (Sorry, I am at work, can not test from here).
> I would be surprised if they are "0 5".

0, 1, 2, 3, 4, 5

>> 4) write 2 magic functions: one to get the next enum value, one to get the
>> previos enum value and implement a special handling in the for-in loop for
>> such arrays
> 
> I always thought Succ/Pred are exactly such magic functions ;-)

yes, forgot about them.

Best regards,
Paul Ishenin.




More information about the fpc-devel mailing list