From: Trans Date: 2005-01-24T22:51:01+09:00 Subject: attr In the upcoming release of Ruby Carats I have a little lib called attr.rb. What it does is define a mater #define_attribute which all attribute defintions are routed thru. Then I redefine #attr (since current definition is basically never used) to call #define_attribute that takes multiple args. Here's an example: .. attr :a, :a= which is equivalent to: .. attr_reader :a .. attr_writer :a It also has some extra freatures that are nice like: .. attr :a?, :b! which is the same as .. def a? .. @a ? true : @a .. end .. .. def b!(x) .. @b.replace x .. end Also these return an array of the symbols of the methods that get defined, so you can use public, private, protected on them. eg. .. private attr :a There are a couple of other features too, but I'll leave those aside for now, as they are not important to this inquery. So I have a few questions. First, what do you think of this in general? Second, there is no "extra" convenient way to do an accessor b/c I haven't been able to find a nice notation --one just has to put both, 'attr :a, :a='. Is this too inconvenient? Can anyone think of a good notation? Thanks, T.