from preamble:
"Change Set: AddAllFix-ac Date: 6 August 2003 Author: Andrew Catton
Fixed bug where:
someCollection addAll: someCollection
causes an infinite loop.
- #addAll*: methods now use a copy of the parameter if it is the same as the receiver. - The old behavior was moved to #basicAddAll*: variants. - #basicAddAll: is used by SortedCollection>>copy to avoid an #addAll:->#copy->#addAll: infinite loop when adding a collection to itself. - Removed OrderedCollection>>addAll: as it didn't actually change the semantics inherited from Collection>>addAll: and would have required a further override on SortedCollection had it remained."!
The problem reported by this bug/fix report from last August stiil exists in 3.7b, The fix proposed does prevent the inifinite loop. Is this the best way to go about this?
frank@crystal-objects.com wrote:
The problem reported by this bug/fix report from last August stiil exists in 3.7b, The fix proposed does prevent the inifinite loop. Is this the best way to go about this?
I submitted a fix for this back in the fall, but have since changed my mind about the best thing to do in this situation. The submitted fix, IIRC, added the collection parameter to a copy of self when it == self. I'm now pretty convinced that an error should just be raised when the parameter == self (since it is almost definitely unintentional, and if you really wanted to do this for some reason you could always explicitly use a copy yourself). Does this sound sensible?
Andrew
Andrew Catton wrote:
frank@crystal-objects.com wrote:
The problem reported by this bug/fix report from last August stiil exists in 3.7b, The fix proposed does prevent the inifinite loop. Is this the best way to go about this?
I submitted a fix for this back in the fall, but have since changed my mind about the best thing to do in this situation. The submitted fix, IIRC, added the collection parameter to a copy of self when it == self. I'm now pretty convinced that an error should just be raised when the parameter == self (since it is almost definitely unintentional, and if you really wanted to do this for some reason you could always explicitly use a copy yourself). Does this sound sensible?
Andrew
Yes I believe the original report I was commenting on was from you. You can close the original report then, as it is yours, and submit a new one with the change you now propose.
regards
Frank Caggiano wrote:
Andrew Catton wrote:
frank@crystal-objects.com wrote:
The problem reported by this bug/fix report from last August stiil exists in 3.7b, The fix proposed does prevent the inifinite loop. Is this the best way to go about this?
I submitted a fix for this back in the fall, but have since changed my mind about the best thing to do in this situation. The submitted fix, IIRC, added the collection parameter to a copy of self when it == self. I'm now pretty convinced that an error should just be raised when the parameter == self (since it is almost definitely unintentional, and if you really wanted to do this for some reason you could always explicitly use a copy yourself). Does this sound sensible?
Andrew
Yes I believe the original report I was commenting on was from you. You can close the original report then, as it is yours, and submit a new one with the change you now propose.
That certainly is something I can do, although we're in the middle of a hectic deployment at work right now, so I can't promise to even look at anything else for a while. That said, this would be a pretty miniscule change--I was mostly interested in whether you or anyone else agreed/disagreed that this was the right thing to do.
Cheers, Andrew
Andrew Catton wrote:
That certainly is something I can do, although we're in the middle of a hectic deployment at work right now, so I can't promise to even look at anything else for a while. That said, this would be a pretty miniscule change--I was mostly interested in whether you or anyone else agreed/disagreed that this was the right thing to do.
I agree with your current proposed solution, raising an error. Definitely leaving it as is isn't a solution, we should never knowingly allow an infinite loop condition. And it does seem that if I wanted to add a copy of myself to myself there are easier and better ways to do it.
If your strapped for time I could post the fix. let me know.
regards
squeak-dev@lists.squeakfoundation.org