From: transfire@... Date: 2006-07-10T22:13:45+09:00 Subject: Re: instance_exec Erik Veenstra wrote: > > Anyway, here the version I put in Facets. Please evaluate. > > > > # The implementation is thread-safe thanks to the > > # Thread.current.object_id trick, but it doesn't work with > > # immediate values (Fixnums and friends),... > > (You're version _does_ work with immediate versions.) > > Mmh... The Module version does work for immediate versions, > too. That might be a good reason... ;] > > Mine doesn't... > > > # ...and most > > # importantly it bombs when given a frozen object. > > > > Object.class_eval{ define_method(mname, &block) } > > This pollutes the global class Object. Not funny... ;] But, > yes, it does work... It should delete it when done, so it's a temporary pollution. But I think to do that right, instead of undef_method that should be remove_method: Object.class_eval{ remove_method(mname) } Good catch thanks. T.