From: Jamis Buck Date: 2004-11-06T01:44:39+09:00 Subject: Re: value provided for argument with default value - how to check inside method? Robert Klemme wrote: > But as I said, my main concern is that this introduces a different pattern > for state access while Ruby has such a pattern already. It has, but it breaks down in certain situations. Consider: class T def initialize( &block ) instance_eval &block end def v @v end def v=( x ) @v = x end end t = T.new do v = 5 end Does T#v= get called? Nope. v is interpreted as a local variable. As it should be--I'm not arguing for it to do otherwise. All I'm saying is that there are times where it is useful to have the setter be like the OP requested. There is even code in Ruby's stdlib that does it that way (tk, for instance). Ruby is known for it's position on TMTOWTDI. Let's not discourage people from exploring these other avenues. If an approach turns out to be cumbersome, it won't be adopted. If it works well, people will use it. - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis