[fpc-devel] Forin feature with tBits
webpirat at mail.ru
Sat Nov 7 11:19:09 CET 2009
Alexander Klenin wrote:
> IMHO, this code demonstrates an inconvenience of the current for..in
> The last "operator enumerator" declaration is clearly redundant.
> I have two alternative suggestions here:
> 1) Let for..in accept the enumerator instead of the container as the
> second argument.
> 2) Define the trivial "operator enumerator" as above for some basic
> type, e.g. TEnumerator,
> maybe in Classes.pp or even System unit. After that, one can inherit
> TBitEnumerator from TEnumerator to avoid the need for "operator
> enumerator" declaration.
> Paul Ishenin, what do you think?
I think that it will be nice to have some extension to select paticular
enumerator for the for-in loop but it is not yet available. And I think
that your first suggestion will add undeeded ambiguity to the compiler
since the expression can be a container and enumerator at the same moment.
More information about the fpc-devel