This is the jist of the conversation relating to this topic. Damian: I hope you don't mind the reprinting of your mail, I'm sending a note to you asking forgiveness rather than permission in advance:
I asked:
We think (and maybe the Exegesis can clarify) that this means the elimination of two<super>*</super> succinct, obvious, and useful idioms. The declaration of C static-like variables ("compile-time" initializations):And other stuff. Damian's reply was:{ my $foo=512; sub something { $foo++; } }
That's now:After I had whined:or:for 1 { my $foo=512; sub something { $foo++; } }INIT { my $foo=512; sub something { $foo++; } }
Cluttering up these expressions with do {} and for 1 {} seems like syntatic nonsense and misdirection.He said:
No, it's just a reflection of the fundamental change that a block is now *always* a closure (and hence a value). I actually think that the INIT {...} or even the BEGIN {...} approach is a much safer way to specify such things anyway, as it guarantees that the shared lexical (a lovely idiom, I agree) is initialized before any potential use of the subroutines that share it.I hope this sheds a little light on the topic. I know it gave me a little more positive outlook on Exegesis 4.
<super>*</super>The other I asked about was shared lexicals between subs: { my $foo; sub bar{} sub baz{} }
In reply to Re: Static variables (and also Perl 6)
by clintp
in thread Static variables (and also Perl 6)
by tye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |