On Friday 02 August 2002 01:55 pm, Reginald Braithwaite-Lee wrote:
> Is it possible to override the assignment operator?
>
> I tried "def operator=", and while the compiler seems to accept the
> syntax, my method is not called at run time :-(

What would be the receiver?

Variables aren't objects, so they can't have methods.
Variables merely point to objects.

You *can* define methods with names that end in equals signs, if you 
want.

If you do that at the outer scope (i.e. as a private method in 
Object), it might look like you've overridden assignment:

def xyz=(something)
	p something
end

xyz = 123

But, of course, there's no variable named xyz.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE