[fpc-pascal] Bls: Bls: Quick Modern Object Pascal Introduction, for Programmers
mailinglists at geldenhuys.co.uk
Wed Jun 22 19:28:33 CEST 2016
On 2016-06-22 18:18, Dennis Poon wrote:
> can we do it in descending order without a user defined enumerator?
Not as far as I know - I believe it is a one directional iterator (or so
the interface suggests). There are tons of limitations with the for..in
Years back I implemented an iterator interface (based on Java definition
of iterators) with multiple implementations for various container
classes I use often. I can iterate forward, backwards, use a regex to
filter (skip) what gets iterated etc. And using the factory method I can
request an iterator instance with ease, and even register more iterators
if needed. So much more flexible [personal opinion].
I've written an article about it some years back:
Look for the “Iterator Pattern” article and sample code.
More information about the fpc-pascal