Re: State variables
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: State variables
- Date: Fri, 05 May 2006 17:32:43 +0200
On Thu, 2006-05-04 at 19:27 +0200, A. Pagaltzis wrote:
* Torsten Schoenfeld <kaffeetisch gmx de> [2006-05-04 19:05]:
If you put a block around a sub, you can declare a lexical
variable in that scope but outside the sub. It will then
behave like a state variable:
Is that really exactly what state variables do? So far, all
explanations about what state variables in Perl 6 are for have
left me confused. I assumed they work the way you outlined, but
all descriptions I’ve seen make them sound much more subtle and
hard to grasp.
All I can find about C<state> variables in Perl 6 seems to suggest that,
yes, that's really all they do.
<http://dev.perl.org/perl6/doc/design/apo/A06.html#PRE/POST/FIRST/LAST/etc.>
<http://dev.perl.org/perl6/doc/design/apo/A12.html#Assignment_to_state_variable_declaration_now_does_"first"_semantics.>
<http://dev.perl.org/perl6/doc/design/syn/S04.html#Closure_traits>
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]