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

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

Thread Previous | Thread Next
Alex Gough
May 24, 2003 16:07
Re: Can I OVERLOAD the assignment operator? Please???
Message ID:
#### [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 <> 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:

> 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

> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About