From: Gavin Sinclair Date: 2004-08-24T03:11:30+09:00 Subject: Re: Attr; and Moving Namespaces On Tuesday, August 24, 2004, 1:09:26 AM, T. wrote: > Okay, just two more questions, I swear. > First of all, how prevalent is the use of #attr? I know of one person who uses it, but his keyboard seems to lack a shift key and parentheses, so perhaps his underscore key is also broken :) I dislike 'attr', as the attr_* methods have a clearer intent and consistent style. I do wish, however, that Ruby collected attribute metadata so you could use it later in the class, to wit: class X attr_reader :x, :y attr_accessor :z attributes.include? :x # -> true attribute(:x).writer? # -> false end That particular API is the result of less thinking than typing, so it's not a literal suggestion; just a germ of an idea. > Secondly, if I create a module, is it possible to "reload" it into another > namespace? ex- > module ObjectModifier > class Object > def new_method > ... > end > end > end > # reload into toplevel > reinclude ObjectModifier #? s/reinclude/include/ and give it a try. I think you'll be pleasantly surprised. Gavin