From: Daniel Berger Date: 2007-01-20T00:00:07+09:00 Subject: Re: auto assign arguments? dblack@wobblini.net wrote: > Hi -- > > On Fri, 19 Jan 2007, David Chelimsky wrote: > > > Wow. You guys are all coming up w/ great alternatives, but would > > somebody please just answer my question? I am not asking for ways to > > do what I want. I'm asking if you think the following proposed syntax > > addition would be useful: > > > > Any parameter preceded by a @ results in an instance variable being > > created and initialized with the submitted value. So: > > > > class MyClass > > def initialize(@a) > > end > > end > > > > instance = MyClass.new(5) > > #results in an instance variable @a with a value of 5 > > That was proposed as an RCR and rejected; see > http://oldrcrs.rubypal.com/rejected.html#rcr3 Hm, no reason given, but one of the things I don't like about it is the change in syntax it required. With the advent of keyword parameters (right?), and the ability to get the parameter names from within a method, this should be trivial to implement on our own in 1.9 if Matz doesn't want it as the default behavior. Dan