in reply to Re: How will you use state declared variables in Perl6?
in thread How will you use state declared variables in Perl6?
Effectively, %seen becomes a Class variable
Not so! A class variable is accessible to all instances of a class. A state variable (assuming it behaves more or less exactly like a static variable in C/C++) is visible only within the declaring function, and if that function is a method, then it is restricted to the instance as well. It's actually a tighter scope than member variables with the same persistence.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How will you use state declared variables in Perl6?
by BrowserUk (Patriarch) on Jul 08, 2005 at 21:25 UTC |
In Section
Meditations