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

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

Thread Previous | Thread Next
From:
Alex Gough
Date:
May 24, 2003 16:07
Subject:
Re: Can I OVERLOAD the assignment operator? Please???
Message ID:
20030524170316.GF16342@the.earth.li
#### [Sat, May 24, 2003 at 09:45:55AM +0100: Nicholas Clark]
> On Fri, May 23, 2003 at 08:31:00AM +0100, Nick Ing-Simmons wrote:
> > Dan Sugalski <dan@sidhe.org> writes:
> > >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.
> > 
> > That is my recollection too.

That's the conclusion I came up with.  There's a perlbug somewhere about it.

Ah, here: http://archive.develooper.com/perl5-porters@perl.org/msg70545.html

> but even if that's not exactly the correct place, the upshot is that
> by the return from SvNV happens the tied variable has returned an
> overloaded value, but now there is no check on whether it's overloaded,
> and whether we should jump back and do overloading.

The return can be overloaded, but as the return is already in SvNV,
the SvNV overloading just gets called again (modulo my memory serving
correctly).

> Answers on a postcard as to how to add such logic without slowing the
> world down (or getting into infinite loops) welcome.

My best thought was pluggable opcodes, but then I realised that would
be a lot of work and went back to hiding under a rock (see also: Perl6).

Alex Gough
-- 
I looked up, she was beautiful: her body shimmered like fish skin, she had
lips like Andrew Lloyd Webber and gills like Prince Charles.  This wasn't
surprising as she was a herring.  She laughed like whitebait tap dancing on
a bed of wet lettuce.  I was in love... and several sizes too big for her.

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