On 7/25/05, Daniel Brockman <daniel / brockman.se> wrote:

> An expression that looks like 'identifier = value' always
> sets a variable, and never calls a method.  This is simply
> the way the language is defined.
> 
> When you want to call a setter method on the current object,
> you *have* to say 'self.foo = bar', precisely because if you
> leave out the 'self.', you will just create a local variable.

I just want to make sure I fully understand this.

Isn't the preferred way of doing this the following?

@foo = bar

Is this equivalent to

self.foo = bar

Is this true?

An expression that looks like '@attr-name = value' always calls a
method whose name is 'attr-name='.

-- 
R. Mark Volkmann
Partner, Object Computing, Inc.