New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pp_each needs its own hash iterator #13341
Comments
From chapter34@yahoo.comCreated by chapter34@yahoo.comAs I have described in my blog article: http://technicalprose.blogspot.co.uk/2013/10/perl-each-function-is-not-re-entrant.html the 'each' function is not re-entrant because it relies on hv_iternext() The following code should work: #!/usr/bin/perl my %global_hash; sub recurse $global_hash{a} = 1; recurse(0, \%global_hash); ....and it would work if 'each' had its own iterator instead of using my %hashcopy = %$hash; or: for my $key (keys %$hash) { Perl Info
|
From @demerphqOn 10 October 2013 12:59, Mark R. Bannister <perlbug-followup@perl.org> wrote:
We don't normally consider this a bug. More a mis-feature. It *is* And, yes, we pretty much all agree that the behavior makes each() less useful. If anything this is a feature request, that has been made many times, But heck, maybe someone will give it a crack one day. Yves -- |
The RT System itself - Status changed from 'new' to 'open' |
From chapter34@yahoo.comOn Fri Oct 11 00:09:41 2013, demerphq wrote:
Sorry, so this is a duplicate ticket? I did a search before I opened it At a cursory glance it doesn't look difficult to fix, so which specific Thanks, |
From @maukeOn 11.10.2013 10:14, Mark R. Bannister via RT wrote:
Your proposed solution only moves the problem. It would make 'each' work my @hashes = ( Implicit state is bad in general. But given the choice between state (Also, changing the existing 'each' operator would break all code -- |
From @LeontOn Thu, Oct 10, 2013 at 12:59 PM, Mark R. Bannister <
Even when ignoring all other issues, this would require to have external Not saying it'd be impossible, but I don't see a way out that isn't Leon |
From @HugmeirOn Fri, Oct 11, 2013 at 5:14 AM, Mark R. Bannister via RT <
It's documented in perldoc -f each. I don't know if there's a ticket about
It's not backwards-compatible. It would slow down every each() call. We That being said, it's likely possible to prototype the intended behavior on |
From zefram@fysh.orgBrian Fraser wrote:
Start by implementing reified iterators. They'll be useful on their As with the recent request about the flip-flop operator, the semantics -zefram |
From @iabynOn Sat, Oct 12, 2013 at 12:33:30AM +0100, Zefram wrote:
An alternative approach might be to make the hash's iterator localise-able. local each %hash; -- |
From @LeontOn Sat, Oct 12, 2013 at 1:33 AM, Zefram <zefram@fysh.org> wrote:
Actually, having some kind of generic iterator sounds like a good idea in Leon |
From @rjbs* Leon Timmermans <fawaka@gmail.com> [2013-10-14T17:08:50]
Yes, it's hard to imaging programming in any non-Perl P-language and not -- |
Migrated from rt.perl.org#120172 (status was 'open')
Searchable as RT120172$
The text was updated successfully, but these errors were encountered: