From: Farrel Lifson Date: 2006-03-14T16:16:16+09:00 Subject: Re: Writing Good #each Methods? > So, this got me thinking: what makes a good #each method? I'd love to > hear any pearls of wisdom if any of you have the time. I think an each method should have the following properties * All elements must be yielded * Each element must be yielded exactly once * If the container has some order associated with it (ie Array or SortedSet) the elements should be yielded in order * If there is more than ordering (such as a post, pre or in order walk round a binary tree) then the elements should be yielded according to the ordering that is as closest to 'natural' ordering (inorder in the case of a binary tree). each methods for the other orderings (each_preorder, each_postorder) must also be provided. That's my opinion, I'm sure other people might disagree with me here. Farrel