From: Alexey Verkhovsky Date: 2004-07-18T09:43:18+09:00 Subject: Re: [NUBY] Ruby Way code for shuffling an array doesn't behave as expected On Sun, 2004-07-18 at 03:04, Mark Hubbart wrote: > I'm not sure that an exception would be The Right Thing A smilie was inadvertently omitted in my earlier post. It should have said "The Right Thing (TM) :)" :) Life is full of compromises, and on the issue of what to do with stale iterators, there are at least three choices: 1. Nothing (fast and dangerous) 2. Iterate over a copy (safe and slow) 3. Iterate over the original, but detect stale iterators (the middle way, much safer than 1 and somewhat faster than 2). Each of the three choices has pros and cons. All I'm saying is that in my personal experience Java's ConcurrentModificationException has prevented or exposed many bugs that otherwise would be subtle and probably very costly affairs. Which is why I like it. But then, the most important difference between Ruby and Java is that the former lets you do anything, and that includes shooting yourself in the foot, too. The latter, meantime, does not believe that you REALLY know what you are doing. :) Best regards, Alex