develooper Front page | perl.perl5.porters | Postings from April 2010

Re: what should 'local @tied' do?

Thread Previous | Thread Next
Vincent Pit
April 11, 2010 12:42
Re: what should 'local @tied' do?
Message ID:

> There are a couple of long-standing open tickets (from Michael Schwern)
> to the effect that with tied arrays and hashes,
>     local @tied
> doesn't DWIM (RT #7938, #7939).
> The current behaviour of local @tied is to create a new array, store it
> in the ARRAY slot of *tied, and then I<attach tie magic to the new array
> too>. This makes the local essentially a noop, and gives the following
> behaviour:

> My preferences in descending order are 2,1,3.

Just a couple of notes to add to the discussion :
- localized tied scalars remains tied.
- when I implemented "delete local $a[$i]/@a[@list]" and optimized "@a =
reverse @a" in the case of a tied array, I made it to check the
existence of elements by calling the EXISTS method, and then delete the
element as needed by calling DELETE. I considered that if you were using
tied variables, you were already accepting an important perfomance hit
and so I decided to aim for the most correct answer (in the context of
tied variables) despite the cost of calling EXISTS and DELETE.


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