From: "Hal E. Fulton" Date: 2002-08-10T04:28:24+09:00 Subject: Re: ambiguity between local variable assignment and writter method ----- Original Message ----- From: "Tom Sawyer" To: "ruby-talk ML" Sent: Friday, August 09, 2002 2:13 PM Subject: Re: ambiguity between local variable assignment and writter method > > Well, I know that this probrem is considered one of pit hole. But > > this syntax may lead implicitly us to a style: Use @var rather than > > var() even if that is a simple attribute. Indeed I prefer @var or > > @var=val bacause the semantics of theml are simpler and clearer then > > #var() or #var=(val). > > unfortunately, this is actually bad form. if a class instance variable > is set up to be accessed via accessor methods, they should be used at > all times. even internally. while, it is functionally equal for the > simplist case, writter methods may do other things as well, like > validate the argument. I can't agree with that. Surely a class is allowed to reference its own member data as it chooses. If it bypasses some kind of needed extra work in the setter, that's simply a bug in the code. If anything has the right and the need to know the class's internals, it is the class itself and the programmer creating it. Hal