Skip to content
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

Variable suicide considered out of fashion #708

Closed
p5pRT opened this issue Oct 12, 1999 · 2 comments
Closed

Variable suicide considered out of fashion #708

p5pRT opened this issue Oct 12, 1999 · 2 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Oct 12, 1999

Migrated from rt.perl.org#1610 (status was 'resolved')

Searchable as RT1610$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 12, 1999

From mjtg@cus.cam.ac.uk

=head2 What is variable suicide and how can I prevent it?

is still there? It refers to a bug which was mended well before
perl5.004. And documenting known bugs in the FAQ is a slightly odd
thing to do. And it certainly hasn't qualified as a _F_AQ for a very
long time. Or even as an IAQ.

I suggest its removal.

Mike Guy

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Dec 19, 2000

From [Unknown Contact. See original ticket]

M.J.T. Guy wonders​:

Is there any good reason why the entry in perlfaq7

=head2 What is variable suicide and how can I prevent it?

is still there? It refers to a bug which was mended well before
perl5.004. And documenting known bugs in the FAQ is a slightly odd
thing to do. And it certainly hasn't qualified as a _F_AQ for a very
long time. Or even as an IAQ.

I suggest its removal.

Inline Patch
--- perlfaq.orig        Tue Dec 19 14:36:08 2000
+++ perlfaq.pod Tue Dec 19 14:37:23 2000
@@ -496,8 +496,6 @@
 
 =item * What's a closure?
 
-=item * What is variable suicide and how can I prevent it?
-
 =item * How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?
 
 =item * How do I create a static variable?
@@ -761,6 +759,10 @@
 =head1 Changes
 
 =over 4
+
+=item 19/December/2000
+
+Removed variable suicide question.
 
 =item 1/November/2000
 
--- perlfaq7.orig       Tue Dec 19 14:36:17 2000
+++ perlfaq7.pod        Tue Dec 19 14:37:42 2000
@@ -322,27 +322,6 @@
 hypothetical timeout() function to access the lexical variable
 $line back in its caller's scope.
 
-=head2 What is variable suicide and how can I prevent it?
-
-Variable suicide is when you (temporarily or permanently) lose the
-value of a variable.  It is caused by scoping through my() and local()
-interacting with either closures or aliased foreach() iterator
-variables and subroutine arguments.  It used to be easy to
-inadvertently lose a variable's value this way, but now it's much
-harder.  Take this code:
-
-    my $f = "foo";
-    sub T {
-      while ($i++ < 3) { my $f = $f; $f .= "bar"; print $f, "\n" }
-    }
-    T;
-    print "Finally $f\n";
-
-The $f that has "bar" added to it three times should be a new C<$f>
-(C<my $f> should create a new local variable each time through the loop).
-It isn't, however.  This was a bug, now fixed in the latest releases
-(tested against 5.004_05, 5.005_03, and 5.005_56).
-
 =head2 How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?
 
 With the exception of regexes, you need to pass references to these
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant