Bug #15984
closed
deleting from a collection while iterating on it
Added by aothelal (Abdelrahman Othman Helal) almost 5 years ago.
Updated over 4 years ago.
Description
If you tried to delete from a collection while iterating on it Ruby will allow you to do this flawlessly. This generates a wrong output collection after doing this action. An exception should be thrown to disallow this to be done.
that totally depends on how you interate over the collection.
if you do it right, ruby has no problem with that
I don't think ruby should disallow this via an exception. The use case
seems fairly odd, too - it is often more idiomatic to do .map, .select,
.reject etc...
This generates a wrong output collection after doing this action.
Could you provide some examples and explain exactly what is wrong with the output collection?
- Status changed from Open to Feedback
- Status changed from Feedback to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0