From: Zev Blut Date: 2005-01-25T23:01:42+09:00 Subject: Re: attr On Mon, 24 Jan 2005 23:12:17 +0900, Jamis Buck wrote: > On 22:51 Mon 24 Jan , Trans wrote: > >> 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 > > Well.... claiming that it is "basically never used" is dangerous. I've > used it, and I know I've seen code that uses it. Changing the > semantics of an existing method is always going to be dangerous, no > matter how infrequently you believe the method is used in practice. > > Caution, caution, caution. :) I fully agree, unless you have access to all the source code ever written in Ruby it is pretty hard to say that is never used. Of course, it is very easy to say something such as "I never use it". But, then how do we know if other people are using certain methods and syntax? I was pretty shocked to see lots of usage of the for statement in some of the source code included in the standard Ruby libraries. Why would anyone use for when the each method exists, especially those who have committed to the Ruby base? Ignore that last question it is only to highlight how I thought most Ruby experts would not use the for statement. Assuming we have access to lots of source we could run a few searches of various method/syntax usage and tally up the results. Luckily, Satoru Takabayashi, is writing a nice tool called "gonzui" to help speed up searching your source. I installed it this weekend and did a bit of playing around with it. Though it is a bit rough around the edges, it shows a lot of potential and is pretty useful now. Certainly faster than grep once you build the indexes. Check it out: http://namazu.org/~satoru/gonzui/ Cheers, Zev