From: Kevin Smith Date: 2001-03-06T11:09:48+09:00 Subject: [ruby-talk:12070] Re: RCR: shortcut for instance variable initialization Dave Thomas wrote: >So far, I like David Black's 'def foo(hoge@)' best. I'm ok with that approach, but personally would like to see it ONLY work for the initialize method. Here's another off-the-wall idea. I don't think I like it either, but maybe it will spark another idea. class Goofy attr :x, :y, :more auto_init :x, :y def initialize(text, x, y, more) # at this point, @x and @y have been set to x and y # @text does not exist, and @more is not initialized yet end end Or a variation would be: class Goofy attr :x, :y, :more def initialize_auto(text, x, y, more_stuff) # at this point, @x and @y have been set to x and y # @text does not exist, and @more is not initialized yet end end Hmmm. Yeah, I think I like the variable@ better than either of these. Kevin