From: Peter Lacey Date: 2006-01-05T06:32:25+09:00 Subject: Re: Repost: singleton methods vs. class instance vars On Jan 4, 2006, at 3:47 PM, Phil Tomson wrote: > I'm not so sure it's faster; it uses a class_eval. There's a comment in the actual active record code that notes that class_eval is used over define_method to get around a memory leak in fcgi. But to Ako's point, it seems to me that there has to be some important difference between the singleton approach and the class instance var approach for several reasons: 1. DHH and the other active record coders and reviewers know what they're doing, and I suspect this seemingly convoluted code wouldn't have survived for very long if it was simply "another way of doing it." 2. I'm very new to Ruby, and I don't know what I'm doing. :-) 3. The active record code _does_ use class instance vars in other places, so this looks very intentional. Any other thoughts? Regards, Pete