From: Daniel DeLorme Date: 2007-01-20T15:26:59+09:00 Subject: Re: auto assign arguments? Yukihiro Matsumoto wrote: > I thought (and I still think) it is a good idea to separate method > argument and assignment in general. It's convention supported by most > languages, and mixing parameters and assignments gives me impression > of toy-language. That's interesting. Would you mind sharing your insight on why these should be separated? To me they seem similar enough to be "merged". I think the only reason to separate them is because, at the machine-language level, function arguments are PUSHed onto the stack while assignments are MOVed to memory. So historically they come from different mechanisms. But if we agree that computer languages should be designed for humans, not computers, it seems more natural to view parameters as a specialized case of assignment. > 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. I can see the number of arguments (and in other languages, their type) as part of the class API, but not their names since those variables' names are local to the method. True, rdoc exposes those internals in the documentation, but then it also exposes the instance variables & methods used for default values. For consistency I think instance variables should be allowed as parameters since they are allowed as default values. But I acknowledge that consistency may not be the most important factor to consider here. I dunno, forbidding instance variables may be the more "correct" approach but I think allowing them would be more useful. One of the reasons I like ruby is because it favors usefulness over strict "correctness" (e.g. you can still get to private methods if you really need it) just my 2円 Daniel