-
Notifications
You must be signed in to change notification settings - Fork 559
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
Allow access to outer $_'s #17165
Comments
From @jidanniCreated by [email protected]$ man perlvar $_ : the default iterator variable in a "foreach" loop if no other OK, but wouldn't it be neat if one could reference "outer $_'s" too, for ( $doc->createElement('Folder') ) { Here $__ refers to the "parent $_". A $___ could refer to the "grandparent $_". Anyway, all of them are remembered in some stack, just currently not Perl Info
|
From @jkeenanOn Wed, 02 Oct 2019 19:45:48 GMT, jidanni wrote:
I suspect that, given the many other uses of '$_' (perldoc perlvar), this would be an implementation nightmare and very bug-prone. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Wed, 02 Oct 2019 12:45:48 -0700, jidanni wrote:
They are remembered on the save stack, but it's non-trivial to get to it, which strikes me as not "no good reason". We could make it simpler to get to those values (add magic to each $_ to point to the parent for example), but that would cost to all such localizing of $_, since $_ is global, and we don't know if the programmer is accessing $__, $___ etc in a called function. The $__, $___ names are bad, since you'd forcing a maintainer to count _ which due to the _ glyph joining together will be difficult to count at a glance. You could just name the values, which will make the code more readable. Tony |
I plan to reject this, unless someone else has an opposing opinion. |
OK go ahead. Maybe it wasn't a good idea. |
Migrated from rt.perl.org#134466 (status was 'open')
Searchable as RT134466$
The text was updated successfully, but these errors were encountered: