On 2012.5.14 5:08 AM, Aristotle Pagaltzis wrote:
> * Peter Corlett <ab...@cabal.org.uk> [2012-05-14 12:20]:
>> On Mon, May 14, 2012 at 11:06:59AM +0200, demerphq wrote:
>>> I kinda wish perl had an interface like
>>
>>> my $iter= iterator(%hash);
>>> while (my ($key,$value)= $iter->each) { }
>>
>>> Which I think would be sane. You could even pass the iterator
>>> without passing the hash itself. (Preventing modifications to the
>>> hash but allowing 3rd party code to iterate it).
>>
>> I suspect it would be relatively simple to write a module to provide
>> that syntax.
> 
> 6 lines for the most minimal pure-Perl implementation. But to really do
> it right (i.e. not eat memory for a copied key list) requires access to
> the hash data structure at a level that AFAIK requires XS.

What was that?  Is that the sound of someone volunteering to fix a bug?!
https://github.com/schwern/perl5i/issues/210


-- 
101. I am not allowed to mount a bayonet on a crew-served weapon.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

Reply via email to