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

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

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
May 23, 2003 00:39
Subject:
Re: Can I OVERLOAD the assignment operator? Please???
Message ID:
20030523073854.1643.6@bactrian.elixent.com
Yitzchak Scott-Thoennes <sthoenna@efn.org> writes:
>On Thu, 22 May 2003 20:52:17 -0400, jpeacock@rowman.com 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
http://www.ni-s.u-net.com/


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