From: 7stud -- Date: 2011-05-05T10:10:13+09:00 Subject: Re: Iterating over an Array of Hashes Chad Perrin wrote in post #996688: > On Thu, May 05, 2011 at 06:21:00AM +0900, Christopher Dicely wrote: >> > indicate a desire for the data to change in the original data structure? >> >> No, I'm claiming that the original requester's statement didn't >> indicate a need to protect against changes resulting from calling >> mutating methods on the keys or values of the hashes, only protection >> from changes resulting from mutations on the hash. > > He didn't specify "only protection from changes resulting from mutations > on the hash." He said he didn't want his actions to change his data > structure, in a very general way. > So you think the folowing statement is a general, mamby-pamby statement: >> What I want to do...is work on a *copy* of >> each element of b, In my opinion, you need to ask yourself two questions with regards to that statement: 1) What are the elements of b? 2) Given the op's code example showing what each element of b looks like, does copying such an element require a deep copy or a shallow copy? -- Posted via http://www.ruby-forum.com/.