develooper Front page | perl.perl5.porters | Postings from May 2003

Re: Can I OVERLOAD the assignment operator? Please???

Thread Previous | Thread Next
From:
John Peacock
Date:
May 22, 2003 14:25
Subject:
Re: Can I OVERLOAD the assignment operator? Please???
Message ID:
3ECD4010.5080606@rowman.com
Dan Sugalski wrote:
> You already can overload the assignment operator. That's what tie is.
> 
> Overloading as it stands now works on the value, while tying works on 
> the variable. (a contents vs container thing) Overload is a value thing, 
> tying a container thing. Assignment is an operation on the variable 
> rather than the value, so it should live in the world of tying, not 
> overloading.

But I need both overloading (to automatically handle the comparison operators) 
_and_ tie (to prevent the overloaded magic from being lost through simple 
assignment).  Can I do both?  My initial tests show that I can use tie to manage 
set/get, but then I lose the overloading.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About