From: Gregory Brown Date: 2009-06-28T12:20:58+09:00 Subject: Re: Attr Methods and object setters On Sat, Jun 27, 2009 at 8:41 PM, Joel VanderWerf wrote: > Gregory Brown wrote: >> >> On Sat, Jun 27, 2009 at 4:52 PM, Fabian >> Streitel wrote: > > ... >>>> >>>> def name(*args) >>>>      return @name if args.empty? >>>>     @name = args.first >>>> end >>> >>> Better, but IMHO that's WAY too much overhead for something as basic as a >>> setter. >>> After all, you have to construct an array everytime you access the >>> setter... >> >> Huh?  This is the way Ruby arguments work no matter what.  Using *args >> just gives you raw access to the arguments. > > No, *args does construct an array. Interesting. Does this really matter though? I know that GC is slow in Ruby but just how soon would this become a problem in practical applications. (I suppose it depends on the application) -greg