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...

Well, have you benchmarked this? Who's to say that the argument list 
isn't already passed in array form? Conceivably it could be _more_ 
efficient this way.

Anyway, "WAY too much overhead" makes no sense. Too much for what? What 
percentage slower does your entire application run with this code? (My 
guess: <1%). So if this code does what you want, and you like the way it 
looks - i.e. it's easy to maintain and pleasing to work with - then 
that's usually worth it.
-- 
Posted via http://www.ruby-forum.com/.