From: Robert Dober Date: 2007-01-20T18:05:27+09:00 Subject: Re: auto assign arguments? ------=_Part_169732_24667512.1169283924753 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/19/07, Yukihiro Matsumoto wrote: > > Hi, > > In message "Re: auto assign arguments?" > on Sat, 20 Jan 2007 01:58:06 +0900, "David Chelimsky" < > dchelimsky@gmail.com> writes: > > > > Besides that, I think formal arguments of a method (including their > names) can be seen as part of class API. Allowing instance variables > as formal arguments seems like disclosing the internal issues. Yes exactly but by explicit declaration, so def set_length(@length) just would be a willful disclosure a little bit like attr_writer :length But your reasoning is sound of course I feel it more important is the unification of method and block parameter behaviour which you have achieved in 1.9. It would be interesting why you allowed instance variables in blocks, maybe because blocks are not exposing an API? I am confusing myself ;) Finally, I admit that the code like this > > def initialize(@length) > end > > is longer than > > def initialize(length) > @length = length > end > > but I feel the intention of the latter code is far clearer than the > former. I agree the first is a little bit against POLS, I do not know any other language where you can define instance variables as formal parameters. I am sure someone will fill this gap quickly though ;) matz. > > Cheers Robert -- "The best way to predict the future is to invent it." - Alan Kay ------=_Part_169732_24667512.1169283924753--