From: Alan Chen Date: 2002-08-10T04:43:52+09:00 Subject: Re: ambiguity between local variable assignment and writter method On Sat, Aug 10, 2002 at 04:30:28AM +0900, Dave Thomas wrote: > This is an interesting issue: should internal users go via the setter > method or access the instance variable directly. Clearly it depends on > the circumstances, but I often find myself writing accessors that do > things such as lazy evaluation, or which set dirty flags for > persistent objects, and where I really do need to go via the method > form. For those times, it's nice to have a shortcut, but it isn't > something I'd fight hard for... :) > > > Regards > > > Dave For me, this is more a point of style. When I write non-trivial accessors, I tend to name the internal variable differently from the method name class Misc def val=(v) # do stuff @in_val = v # do other stuff end end If the accessor is trivial, I usually leave them the same. -- Alan Chen Digikata LLC http://digikata.com