In article <200307182302.26069.spectra / debian.org>, Pablo Lorenzzoni <spectra / debian.org> wrote: >Hello! > >class Klass > attr_accessor :att1, :att2 > def initialize(att1, att2) > @att1 = att1 > @att2 = att2 > end > .... >end > >Is it just me or the construction above is rather common? Is there such a >thing as a default cosntructor? Something that could turn that into > >class Klass > attr_accessor :att1, att2 > initializer(att1,att2) >end > >or even > >class Klass > attr_accessor :att1, :att2 > initializer >end > >Since we have short cuts as attr_accessor, attr_writer and attr_reader, >shouldn't we have a constructor short cut? > This is an idea that's been floating around: class Klass attr_accessor :att1, :att2 def initialize(@att1,@att2) end end ....but alas, Matz doesn't like it :-( says it's ugly. I think it looks quite nice actually. Clean, concise, no duplications. Phil