jbc wrote: > (I posted this before on the google-group rather than the usenet > group, but it seems not to have shown up. I don't know why. If this is > a duplicate for anyone, my apologies) > > def initialize(foo,bar,bat) > @foo,@bar,@bat = foo,bar,bat > end > > Seems clumsy and not at all DRY. > > What would seem the obvious approach to me would be this: > > def initialize(@foo,@bar,@bat) > end > > Is there a reason it's not done that way? > This has been discussed on ruby-talk, but it might have been a few years ago. You can do this: class Foo define_method :initialize do |@x,@y,@z| end end p Foo.new(1,2,3) # ==> #<Foo:0xb7cce1e4 @x=1, @z=3, @y=2> You might want to verify that this construct is allowed in 1.9 before using it heavily. ISTR it is deprecated. If a method has more than two positional arguments, I tend to look for alternatives. YMMV of course. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407