Re: Data::Swap and ponie

[email protected] (Matthijs van Duin) Mon, 11 Oct 2004 18:20:54 +0200
Newsgroups perl.ponie.dev
Message-ID <[email protected]>
On Mon, Oct 11, 2004 at 11:52:52AM -0400, Dan Sugalski wrote:
>Yeek. Looks like Data::Swap swaps the contents of two SVs.
>
>Should we have an equivalent API entry for Parrot? (I'm presuming 
>this is useful, but I'm nervous about allowing it as it can break 
>static assumptions about types)

It can already break things in perl5.  If you do:

swap \$x, \@y;

you're going to help yourself into a world of hurt.

I don't know of a good way to avoid that, especially since it's explicitly 
legal to use swap to change the type of a var that's only accessible via 
references.

Note that the latest version of Data::Swap already does more than swapping 
SvANY and SvFLAGS... it fixes backrefs and keeps an eye out for overloading.

-- 
Matthijs van Duin  --  May the Forth be with you!