in reply to Re^2: How will you use state declared variables in Perl6?
in thread How will you use state declared variables in Perl6?
Then later...package Bar; sub new { ... } sub foo { state $bar; $bar++; return $bar; }
At least this is my understanding. Is this what you meant, BrowserUK?$bar1 = Bar->new(); $bar2 = Bar->new(); $bar1->foo(); # returns 1, as you would expect $bar1->foo(); # returns 2, as you would expect $bar2->foo(); # returns 3, possibly unexpected
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How will you use state declared variables in Perl6?
by Limbic~Region (Chancellor) on Jul 08, 2005 at 22:03 UTC | |
|
Re^4: How will you use state declared variables in Perl6?
by BrowserUk (Patriarch) on Jul 08, 2005 at 22:38 UTC | |
by TimToady (Parson) on Jul 08, 2005 at 22:44 UTC | |
by BrowserUk (Patriarch) on Jul 08, 2005 at 22:49 UTC | |
by TimToady (Parson) on Jul 08, 2005 at 23:12 UTC | |
by BrowserUk (Patriarch) on Jul 08, 2005 at 23:23 UTC | |
|