Hello,
Exactly, which is why I prefer the idea Borland has gone for. The STL
is not
a good idea.
The behaviour of the d9 iterators appear to me very unspecific. In which
I think this is because the origin of this information is only a blog
entry, no specification...
order does it iterate through the elements? What happens if I delete an
element while iterating, maybe even the current. Does an iterator stay
valid if I remove the element from the container?
See below.
How can I change how the iterator behaves? etc.
Implement the interface methods for iterating over the class according
to one's wishes I suppose.
---
For Arrays: as indicated it's just a shorthand for a "for i := low(arr)
to high(arr) "
For IEnumerable: I guess they'll comply to the behaviour of the
IEnumerable interface of .NET, so have a look there:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsienumeratorclasstopic.asp
Outline:
- if the collection is changed while iterating over it, IEnumerable
throws an exception
- no inherent thread safety
- behaviour (e.g. iteration order) specific to implementation
I think this syntactic sugar construct is better than nothing: At least
I make a lot of mistakes regarding lost "-1" when specifying the upper
bound when writing code to iterate over a TStringList or similar - or
the imo stupid and repetitive "for i := low(xy) to high(xy) do begin"
sequences all over the place in case of normal arrays.
What's more interesting for me is that it seems that there will be a
Delphi compiler emitting native code again... :-)
Regards,
Thomas
One cent...
___
fpc-pascal maillist - [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal