develooper Front page | perl.ithreads | Postings from August 2002

Re: Thread-Tie-0.01

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
August 13, 2002 13:35
Subject:
Re: Thread-Tie-0.01
Message ID:
20020813203420.1636.3@bactrian.ni-s.u-net.com
Elizabeth Mattijsen <liz@dijkmat.nl> writes:
>At 04:59 PM 8/12/02 +0100, Nick Ing-Simmons wrote:
>> >I'm not sure I'm following you here...  Could you elaborate?
>>tie @tied_array;  # 10000 elements say
>>
>>foreach my $value (@tied_array)  # 10000 extra SVs tied to elements
>>  {
>>   print $value;
>>  }  # all freed here
>>
>>foreach my $i (0..$#tied_array)
>>  {
>>   my $value = $tied_array[$i];   # Just one extra SV tied to an element
>>   print $value;
>>  } # free'd / reused here
>
> From Arthur's description I got the impression that there wouldn't be any 
>difference in these approaches.  Both will do a FETCH and store it in an SV 
>associated with the element.  It's just that in the first case this happens 
>when building the list in foreach(), the second it is when fetching it 
>inside the loop.
>
>Am I reading Arthur's explanation the wrong way then?

There need only be one "slave element" SV per array - the "slaves" are not 
stored in the 'local' array - just returned by FETCH.

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


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