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

Also, what should 'local @tied[4,6,8]' do?

Thread Next
David Nicol
April 13, 2010 10:15
Also, what should 'local @tied[4,6,8]' do?
Message ID:
On Sun, Apr 11, 2010 at 2:17 PM, Dave Mitchell <> wrote:

> Anyway, I can see three possibilities for the behaviour of 'local @tied':

A fourth, or maybe zeroth, possibility would be for localizing a tied array
to throw an exception.

What happens with localizing slices of tied hashes? Or slices of arrays?

    local @ENV{qw/PATH USER/} = qw(/umkc/lib/garden hlinda);

Making the operation on @arr equivalent to the operation on @arr[0..$#arr]
makes sense, but that might be broken too ( i do not know )

calling STORE and FETCH on a tied array (or a tied hash slice) a lot seems
wrong, as the side effects could be horrible.

maybe local(@tied) could be disallowed under strict?

maybe local could introduce a wrapper layer that would intercept accesses to
the localized elements and refer them to in-memory data?

   local @ta;

would use the non-tied option, and

   local $ta[4]

would become something like

   $saved = \@ta;
   tie @{*ta = []}, Tie::Array::Overlay => $saved, 4

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