http://qs321.pair.com?node_id=633937


in reply to Re^6: self-feeding infinite loop
in thread self-feeding infinite loop

dangerous: Being able or likely to do harm.

I don't disagree that my mental model might be flawed. However, given my internal concept of foreach it is likely that modifying the array while using for each is dangerous (likely to do harm).

You could certainly make your points without splitting hairs on the meanings of words. The fact is perl has foreach to hide the use of an index to iterate over an array, makeing most array usage much easier in the process. I believe that this act of obscuring the underlying use of indexes would also mean that the actual implementation is not a reliable way to decide how it will respond when you modify the array. Since the documentation explicitly says not to do it and I don't know how its implemented internally, I'll stick with not modifying it and I don't have to attribute it to fear or a faulty mental model, it's just good since.


___________
Eric Hodges