From: Daniel Martin Date: 2006-07-15T19:49:38+09:00 Subject: Re: Preferred monkeypatching technique Eric Hodel writes: > You don't need a mutex. > > class Symbol > @gensym_count = 0 > def self.gensym > ("__gensym__%X" % @gensym_count += 1).intern > end > end Okay, but now if two different files include this exact code, you're re-generating the same symbols. This is why I used ||=, making your code: class Symbol @gensym_count ||= 0 def Symbol.gensym ("__gensym__%X" % @gensym_count += 1).intern end end At the very least, two people using the same exact code to define gensym shouldn't collide with each other.