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

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

Thread Previous | Thread Next
Nick Ing-Simmons
May 23, 2003 00:39
Re: Can I OVERLOAD the assignment operator? Please???
Message ID:
Yitzchak Scott-Thoennes <> writes:
>On Thu, 22 May 2003 20:52:17 -0400, wrote:
>>Dan Sugalski wrote:
>>> That's something I think you can't do, and arguably a bug. I'm pretty 
>>> sure you can have tie magic, or overloading magic, but not both.
>>So that is a vote in favor???  ;~)
>>As I understand it, the reason you cannot mix your magics is that overload only 
>>operates on RV's, so there is no magic table to lookup the set magic callback 
>>from.  There is no reason to *fully* emulate tie, since there is already a get 
>>magic (overload stringify/numify) that covers that case.
>How could tie magic (or any other get magic) and overloading coexist?

It is a linked list you can have multiple MG * on one SV.
This is how Tk's 'U' magic can co-exist with tie - so you can "watch" 
a tied variable.

>Doesn't seem like a bug to me.
>On the other hand, I can't think of any reason you couldn't combine
>set magic and overload.  But that doesn't mean it would work...
Nick Ing-Simmons

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About