From: Paul Lutus Date: 2006-12-02T08:20:05+09:00 Subject: Re: Simple iteration in a function problem Blake Miller wrote: / ... >> Posting bits and pieces of code, but never a short working example, is a >> sure way to assure that this thread will go on forever. > Why can't it be a string, I can use whatever I want to identify an > object. 1. I can see why this thread goes on so long -- instead of meeting my request, you just changed the subject. 2. It should not be a string because your goal is to compare two object IDs, not strings. You are calling the variable "uniqueId", don't you think it should be what it says it is? BTW use the Rubyish "unique_id" rather than "uniqueId". > Now, if you're saying it's not possible to compare two strings, > then I'd see your point. It is possible to compare two strings, but your goal is to compare two object IDs. Object IDs are not strings, and strings are not object IDs. > I can't make the code any simpler without > sacrificing understanding of what I'm trying to accomplish. It's very > simple, each component has an id, a unique id, that I assign to it, > which is a string, Don't use a string. Use the object ID provided by (object).object_id. That way, you won't confuse everyone including yourself. > and is unique (I'll enforce that later). I have an > array of these components, and I want to search that array given a > string to find the matching component by id. And matching by ID rather than by string is faster, along with everything else. -- Paul Lutus http://www.arachnoid.com