Piers Cawley writes: > is static? > Discussion of static/state variables continued. Arcadi Shehter wondered > if it made sense to attach "but" properties to closures. I confess I > didn't really understand what he was driving at. Austin Hastings and
Actually, I was confused , thinking that state declare trait ("is" property ) of the closure , and that could explain examples before that letter in the thread. But then it became clear that state declare property ( "but" property ) of the closure - in the sence that it is born anew every time closure is created. But then , it is still unclear , how one should look at closure - as a variable , as a value , or both. also , From the post of Larry Wall , {... state $a = INIT/FIRST/ENTER/... { ... } ; ...} force evaluation of the whole closure at the time prescribed by INIT/FIRST/ENTER/... . this is similar to behaviour in perl5: sub a{ my $x = shift ; my $y ; return sub { INIT{$y=1}; $x+$y } } print a(1)->(), a(2)->() ; #print 22 so , yes, "state" creates "but" property of the closure , but its initialization controlls when and how many times that closure will be created. arcadi