Mailing List Archive

A 'permanent' keyword
Hi Porters!
I would love to see a permanent keyword for Perl. It initializes a variable once and only once. It would look like this:
    #!/usr/bin/env perl
    use 5.38.0;    use warnings;
    sub variables {        my $name = shift;        return sub {            my $my = 1;            state $state = 1;            permanent $permanent = 1;            say "$name: my is $my. state is $state. permanent is $permanent";            $_++ for $my, $state, $permanent;        }    }
    my $first  = variables('first');    my $second = variables('name');
    say "First";    $first->();    $first->();    $first->();
    say "Second";    $second->();    $second->();    $second->();
And the output would be:
    First    first: my is 1. state is 1. permanent is 1    first: my is 1. state is 2. permanent is 2    first: my is 1. state is 3. permanent is 3    Second    name: my is 1. state is 1. permanent is 4    name: my is 1. state is 2. permanent is 5    name: my is 1. state is 3. permanent is 6

Currently, state's documentation says this:
    "state" declares a lexically scoped variable,    just like "my".  However, those variables will     never be reinitialized, contrary to lexical    variables that are reinitialized each time their    enclosing block is entered.  See "Persistent    Private Variables" in perlsub for details.
But that's not quite correct. It's never reinitialized unless the scope is dynamic, in which case it is.
Permanent variables would never be reinitialized. Not only will this be more clear to existing Perl developers, it might help new Perl developers who misuse state variables. It might also clear up future issues with Corinna, but I won't go there now :)
Best,Ovid-- IT consulting, training, specializing in Perl, databases, and agile developmenthttp://www.allaroundtheworld.fr/. 
Buy my book! - http://bit.ly/beginning_perl
Re: A 'permanent' keyword [ In reply to ]
On Wed, Nov 10, 2021 at 1:59 PM Ovid via perl5-porters <
perl5-porters@perl.org> wrote:

> Hi Porters!
>
> I would love to see a permanent keyword for Perl. It initializes a
> variable once and only once. It would look like this:
>
> #!/usr/bin/env perl
>
> use 5.38.0;
> use warnings;
>
> sub variables {
> my $name = shift;
> return sub {
> my $my = 1;
> state $state = 1;
> permanent $permanent = 1;
> say "$name: my is $my. state is $state. permanent is
> $permanent";
> $_++ for $my, $state, $permanent;
> }
> }
>
> my $first = variables('first');
> my $second = variables('name');
>
> say "First";
> $first->();
> $first->();
> $first->();
>
> say "Second";
> $second->();
> $second->();
> $second->();
>
> And the output would be:
>
> First
> first: my is 1. state is 1. permanent is 1
> first: my is 1. state is 2. permanent is 2
> first: my is 1. state is 3. permanent is 3
> Second
> name: my is 1. state is 1. permanent is 4
> name: my is 1. state is 2. permanent is 5
> name: my is 1. state is 3. permanent is 6
>
>
> Currently, state's documentation says this:
>
> "state" declares a lexically scoped variable,
> just like "my". However, those variables will
> never be reinitialized, contrary to lexical
> variables that are reinitialized each time their
> enclosing block is entered. See "Persistent
> Private Variables" in perlsub for details.
>
> But that's not quite correct. It's never reinitialized unless the scope is
> dynamic, in which case it is.
>
> Permanent variables would *never* be reinitialized. Not only will this be
> more clear to existing Perl developers, it might help new Perl developers
> who misuse state variables. It might also clear up future issues with
> Corinna, but I won't go there now :)
>

This is a bit confusing. The scope you created is not any more dynamic than
any other - you are creating a different subroutine with its own pad. I
think if you want a variable to be permanent through multiple pads, that's
what the package stash is for.

-Dan
Re: A 'permanent' keyword [ In reply to ]
On Wed, Nov 10, 2021 at 2:23 PM Dan Book <grinnz@gmail.com> wrote:

> On Wed, Nov 10, 2021 at 1:59 PM Ovid via perl5-porters <
> perl5-porters@perl.org> wrote:
>
>> Hi Porters!
>>
>> I would love to see a permanent keyword for Perl. It initializes a
>> variable once and only once. It would look like this:
>>
>> #!/usr/bin/env perl
>>
>> use 5.38.0;
>> use warnings;
>>
>> sub variables {
>> my $name = shift;
>> return sub {
>> my $my = 1;
>> state $state = 1;
>> permanent $permanent = 1;
>> say "$name: my is $my. state is $state. permanent is
>> $permanent";
>> $_++ for $my, $state, $permanent;
>> }
>> }
>>
>> my $first = variables('first');
>> my $second = variables('name');
>>
>> say "First";
>> $first->();
>> $first->();
>> $first->();
>>
>> say "Second";
>> $second->();
>> $second->();
>> $second->();
>>
>> And the output would be:
>>
>> First
>> first: my is 1. state is 1. permanent is 1
>> first: my is 1. state is 2. permanent is 2
>> first: my is 1. state is 3. permanent is 3
>> Second
>> name: my is 1. state is 1. permanent is 4
>> name: my is 1. state is 2. permanent is 5
>> name: my is 1. state is 3. permanent is 6
>>
>>
>> Currently, state's documentation says this:
>>
>> "state" declares a lexically scoped variable,
>> just like "my". However, those variables will
>> never be reinitialized, contrary to lexical
>> variables that are reinitialized each time their
>> enclosing block is entered. See "Persistent
>> Private Variables" in perlsub for details.
>>
>> But that's not quite correct. It's never reinitialized unless the scope
>> is dynamic, in which case it is.
>>
>> Permanent variables would *never* be reinitialized. Not only will this
>> be more clear to existing Perl developers, it might help new Perl
>> developers who misuse state variables. It might also clear up future
>> issues with Corinna, but I won't go there now :)
>>
>
> This is a bit confusing. The scope you created is not any more dynamic
> than any other - you are creating a different subroutine with its own pad.
> I think if you want a variable to be permanent through multiple pads,
> that's what the package stash is for.
>

Or a state variable initialized in the scope containing the closure.

-Dan
Re: A 'permanent' keyword [ In reply to ]
'state' can be easily replicated with lexical
closures:

{
my $foo;
sub bar {
++$foo;
#...do stuff
return $foo;
}
}

What's the form for 'permanent'?

I just want to understand. Thanks!

Cheers,
Brett

* Ovid via perl5-porters <perl5-porters@perl.org> [2021-11-10 18:59:03 +0000]:

> Hi Porters!
> I would love to see a permanent keyword for Perl. It initializes a variable once and only once. It would look like this:
> ? ? #!/usr/bin/env perl
> ? ? use 5.38.0;? ? use warnings;
> ? ? sub variables {? ? ? ? my $name = shift;? ? ? ? return sub {? ? ? ? ? ? my $my = 1;? ? ? ? ? ? state $state = 1;? ? ? ? ? ? permanent $permanent = 1;? ? ? ? ? ? say "$name: my is $my. state is $state. permanent is $permanent";? ? ? ? ? ? $_++ for $my, $state, $permanent;? ? ? ? }? ? }
> ? ? my $first? = variables('first');? ? my $second = variables('name');
> ? ? say "First";? ? $first->();? ? $first->();? ? $first->();
> ? ? say "Second";? ? $second->();? ? $second->();? ? $second->();
> And the output would be:
> ? ? First? ? first: my is 1. state is 1. permanent is 1? ? first: my is 1. state is 2. permanent is 2? ? first: my is 1. state is 3. permanent is 3? ? Second? ? name: my is 1. state is 1. permanent is 4? ? name: my is 1. state is 2. permanent is 5? ? name: my is 1. state is 3. permanent is 6
>
> Currently, state's documentation says this:
> ? ? "state" declares a lexically scoped variable,? ? just like "my".? However, those variables will?? ? never be reinitialized, contrary to lexical? ? variables that are reinitialized each time their? ??enclosing block is entered.? See "Persistent? ? Private Variables" in perlsub for details.
> But that's not quite correct. It's never reinitialized unless the scope is dynamic, in which case it is.
> Permanent variables would never?be reinitialized. Not only will this be more clear to existing Perl developers, it might help new Perl developers who misuse state variables. It might also clear up future issues with Corinna, but I won't go there now :)
> Best,Ovid--?IT consulting, training, specializing in Perl, databases, and agile developmenthttp://www.allaroundtheworld.fr/.?
> Buy my book! - http://bit.ly/beginning_perl

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: A 'permanent' keyword [ In reply to ]
> On Wednesday, 10 November 2021, 20:41:57 CET, Oodler 577 via perl5-porters <perl5-porters@perl.org> wrote:



> 'state' can be easily replicated with lexical
> closures:
>
> {
>  my $foo;
>  sub bar {
>   ++$foo;
>    #...do stuff
>    return $foo;
>  }
> }
>
> What's the form for 'permanent'?

Ironically, depending on the surrounding code, the example you give would be for "permanent" variables, not "state" variables. What we currently use as "state" variables get reset in a dynamic scope, as my original code shows. Your example seems to match the "state" documentation, but doesn't match the state behavioe.
"state" could be replaced with lexical closures when done correctly. When done correctly, "permanent" could, also. "When done correctly" is the problem.
The docs for "state" *seem* to imply the semantics I would like to see for "permanent", but the behavior is different. Static lexical scope and dynamic lexical scope are different beasts.
There are a couple of times I've been bitten by thinking "state" would imply the semantics of what I describe as "permanent". This is usually when I am building code dynamically and I hate building scaffolding to remember that.
So ...

- "my" reinitializes every lexical scope
- "state" reinitializes every dynamic lexical scope
- "permanent" never reinitializes (which is what the docs for "state" imply to me)

I suspect (but can't prove) that "permanent" probably matches what most developers think of as "state", and those developers who can appreciate "dynamic lexical scope" would hopefully understand the difference.
    #!/usr/bin/env perl
    sub foo { # static lexical scope        ...        return sub { # dynamic lexical scope            ...        }    }
Best,Ovid-- IT consulting, training, specializing in Perl, databases, and agile developmenthttp://www.allaroundtheworld.fr/. 
Buy my book! - http://bit.ly/beginning_perl
Re: A 'permanent' keyword [ In reply to ]
On Wed, Nov 10, 2021 at 3:46 PM Ovid via perl5-porters <
perl5-porters@perl.org> wrote:

> > On Wednesday, 10 November 2021, 20:41:57 CET, Oodler 577 via
> perl5-porters <perl5-porters@perl.org> wrote:
>
>
>
> > 'state' can be easily replicated with lexical
> > closures:
> >
> > {
> > my $foo;
> > sub bar {
> > ++$foo;
> > #...do stuff
> > return $foo;
> > }
> > }
> >
> > What's the form for 'permanent'?
>
> Ironically, depending on the surrounding code, the example you give would
> be for "permanent" variables, not "state" variables. What we currently use
> as "state" variables get reset in a dynamic scope, as my original code
> shows. Your example seems to match the "state" documentation, but doesn't
> match the state behavioe.
>
> "state" could be replaced with lexical closures when done correctly. When
> done correctly, "permanent" could, also. "When done correctly" is the
> problem.
>
> The docs for "state" *seem* to imply the semantics I would like to see for
> "permanent", but the behavior is different. Static lexical scope and
> dynamic lexical scope are different beasts.
>
> There are a couple of times I've been bitten by thinking "state" would
> imply the semantics of what I describe as "permanent". This is usually when
> I am building code dynamically and I hate building scaffolding to remember
> that.
>
> So ...
>
>
> - "my" reinitializes every lexical scope
> - "state" reinitializes every dynamic lexical scope
> - "permanent" never reinitializes (which is what the docs for "state"
> imply to me)
>
>
> I suspect (but can't prove) that "permanent" probably matches what most
> developers think of as "state", and those developers who can appreciate
> "dynamic lexical scope" would hopefully understand the difference.
>
> #!/usr/bin/env perl
>
> sub foo { # static lexical scope
> ...
> return sub { # dynamic lexical scope
> ...
> }
> }
>

Thanks for explaining, this is new terminology for me - unrelated to the
concept of dynamic scope used in the documentation (runtime scoping).

Perhaps an addition to the documentation could be made, but this seems like
expected behavior to me.

-Dan
Re: A 'permanent' keyword [ In reply to ]
> On Wednesday, 10 November 2021, 21:57:56 CET, Dan Book <grinnz@gmail.com> wrote:
> Thanks for explaining, this is new terminology for me - unrelated to the concept of dynamic scope used in the > documentation (runtime scoping).>> Perhaps an addition to the documentation could be made, but this seems like expected behavior to me.
Hmm, I didn't know the term "runtime scoping" was used. I just pulled the latest Perl from github and did a `git grep -i 'runtime scoping' and it returned no results.
I made up the term "dynamic scoping" because I didn't know there was a term for it. I don't see anything in in the pod/ directory that matches this, either.
I definitely think there's room for improvement in the docs, but I'm loathe to submit a patch to further confuse the documentation if there's already something there that I missed.
Best,Ovid
Re: A 'permanent' keyword [ In reply to ]
Resending this as plain text because I now see it's getting mangled in the archive. I'll be a better citizen in the future.

I would love to see a permanent keyword for Perl. It initializes a variable once and only once. It would look like this:

    #!/usr/bin/env perl

    use 5.38.0;
    use warnings;

    sub variables {
        my $name = shift;
        return sub {
            my $my = 1;
            state $state = 1;
            permanent $permanent = 1;
            say "$name: my is $my. state is $state. permanent is $permanent";
            $_++ for $my, $state, $permanent;
        }
    }

    my $first  = variables('first');
    my $second = variables('name');

    say "First";
    $first->();
    $first->();
    $first->();

    say "Second";
    $second->();
    $second->();
    $second->();

And the output would be:

    First
    first: my is 1. state is 1. permanent is 1
    first: my is 1. state is 2. permanent is 2
    first: my is 1. state is 3. permanent is 3
    Second
    name: my is 1. state is 1. permanent is 4
    name: my is 1. state is 2. permanent is 5
    name: my is 1. state is 3. permanent is 6


Currently, state's documentation says this:

    "state" declares a lexically scoped variable,
    just like "my".  However, those variables will 
    never be reinitialized, contrary to lexical
    variables that are reinitialized each time their
    enclosing block is entered.  See "Persistent
    Private Variables" in perlsub for details.

But that's not quite correct. It's never reinitialized unless the scope is dynamic, in which case it is.

Permanent variables would never be reinitialized. Not only will this be more clear to existing Perl developers, it might help new Perl developers who misuse state variables. It might also clear up future issues with Corinna, but I won't go there now :)

Best,
Ovid
-- 
IT consulting, training, specializing in Perl, databases, and agile development
http://www.allaroundtheworld.fr/. 

Buy my book! - http://bit.ly/beginning_perl






On Wednesday, 10 November 2021, 22:08:10 CET, Ovid via perl5-porters <perl5-porters@perl.org> wrote:





> On Wednesday, 10 November 2021, 21:57:56 CET, Dan Book <grinnz@gmail.com> wrote:


> Thanks for explaining, this is new terminology for me - unrelated to the concept of dynamic scope used in the > documentation (runtime scoping).
>
> Perhaps an addition to the documentation could be made, but this seems like expected behavior to me.

Hmm, I didn't know the term "runtime scoping" was used. I just pulled the latest Perl from github and did a `git grep -i 'runtime scoping' and it returned no results.

I made up the term "dynamic scoping" because I didn't know there was a term for it. I don't see anything in in the pod/ directory that matches this, either.

I definitely think there's room for improvement in the docs, but I'm loathe to submit a patch to further confuse the documentation if there's already something there that I missed.

Best,
Ovid
Re: A 'permanent' keyword [ In reply to ]
On Wed, Nov 10, 2021 at 4:07 PM Ovid <curtis_ovid_poe@yahoo.com> wrote:

> > On Wednesday, 10 November 2021, 21:57:56 CET, Dan Book <grinnz@gmail.com>
> wrote:
>
> > Thanks for explaining, this is new terminology for me - unrelated to the
> concept of dynamic scope used in the > documentation (runtime scoping).
> >
> > Perhaps an addition to the documentation could be made, but this seems
> like expected behavior to me.
>
> Hmm, I didn't know the term "runtime scoping" was used. I just pulled the
> latest Perl from github and did a `git grep -i 'runtime scoping' and it
> returned no results.
>
> I made up the term "dynamic scoping" because I didn't know there was a
> term for it. I don't see anything in in the pod/ directory that matches
> this, either.
>
> I definitely think there's room for improvement in the docs, but I'm
> loathe to submit a patch to further confuse the documentation if there's
> already something there that I missed.
>

"dynamic scoping" is explained here:
https://perldoc.perl.org/perlsub#Temporary-Values-via-local() and referred
to in various places as "dynamic variables" which is a bit confusing in
itself, but perhaps accurate to how local actually works. Runtime scoping
is not a term used by the documentation, just my explanation of what it
means - the scope of the value/variable is defined by runtime behavior, not
only the structure of the program.

-Dan
Re: A 'permanent' keyword [ In reply to ]
On Wed, 10 Nov 2021 at 19:59, Ovid via perl5-porters <perl5-porters@perl.org>
wrote:

> Hi Porters!
>
> I would love to see a permanent keyword for Perl. It initializes a
> variable once and only once. It would look like this:
>
> #!/usr/bin/env perl
>
> use 5.38.0;
> use warnings;
>
> sub variables {
> my $name = shift;
> return sub {
> my $my = 1;
> state $state = 1;
> permanent $permanent = 1;
> say "$name: my is $my. state is $state. permanent is
> $permanent";
> $_++ for $my, $state, $permanent;
> }
> }
>
>
you can achieve described behaviour by moving "permanent line" into parent
scope:

sub variables {
my $name = shift;
state $permanent = 1;
return sub {
my $my = 1;
state $state = 1;
say "$name: my is $my. state is $state. permanent is $permanent";
$_++ for $my, $state, $permanent;
}
}

Extrapolating your idea - it will be imho better to be able to specify
variable "in scope", eg:
sub variables {
SCOPE:
my $name;
return sub {
state $state;
# expressing intention not suggesting syntax
UPPER SCOPE { state $permanent }
}
}

it will allow to concise for example phaser blocks, current state:
my $foo;
BEGIN { $foo = 'bar' };

BEGIN { UPPER { my $foo = 'bar' } }
Re: A 'permanent' keyword [ In reply to ]
another imaginary way to do this (all of these things, state, permament,
etc) is with the non-existent ONCE keyword that executes its block once,
essentially prefixing it with

$unique_package_scoped++ and return;

except the effect would optimzed the block out instead of turning it into a
no-op.


--
"Lay off that whiskey, and let that cocaine be!" -- Johnny Cash
Re: A 'permanent' keyword [ In reply to ]
It's kindof unfortunate that `state` behaves in this manner, as it
isn't actually very useful.

What you describe is exactly what C calls a `static` variable. Because
it isn't lexical, nor is it dynamic. It exists exactly once.

I actually wonder whether the keyword "static" should be used here.

In any case, it's ~trivial to implement that as a CPAN module as a
pluggable keyword. So I'd suggest someone go do that first, and we'll
see how it goes.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: A 'permanent' keyword [ In reply to ]
* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-11-11 16:59:32 +0000]:

> It's kindof unfortunate that `state` behaves in this manner, as it
> isn't actually very useful.

Having stateful subroutines is helpful in some cases, here is a
trivial example. Obviously YMMV depending on how crazy one gets,
but for a simple FSM it implicitly makes consumer code a lot more
natural:

https://gist.github.com/oodler577/9ae279734c2377fdc371affe19057d85

>
> What you describe is exactly what C calls a `static` variable. Because
> it isn't lexical, nor is it dynamic. It exists exactly once.
>
> I actually wonder whether the keyword "static" should be used here.

I thought about that, with my very limited C knowledge, if 'static' is
what's actually wanted here. This would not be a terrible concept to
consider.

>
> In any case, it's ~trivial to implement that as a CPAN module as a
> pluggable keyword. So I'd suggest someone go do that first, and we'll
> see how it goes.
>


Too rich for my blood x) - but yeah I think it'd be neat to see.

Cheers,
Brett

> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: A 'permanent' keyword [ In reply to ]
>
> sub variables {
> my $name = shift;
>
return sub {
> my $my = 1;
> state $state = 1;
> permanent $permanent = 1;
> say "$name: my is $my. state is $state. permanent is
> $permanent";
> $_++ for $my, $state, $permanent;
> }
> }
>


Lest we forget, "state" got introduced because "my $x if 0;" was turned
into a syntax error or something.
Here's how to produce the requested output using Perl 5.0:

{ # scope to hold $permanent
my $permanent = 1; # gets declared at parse-time,
# but remains undef until execution reaches this line
# or the first time the result of variables is invoked
sub variables { # closes over $permanent
my $name = shift;
my $state = 1;
sub { # closes over $name and $state
my $my = 1; # goes away after getting incremented
print "$name: my is $my. state is $state. permanent is
$permanent\n";
$_++ for $my, $state, $permanent;
}
}
}



--
"Lay off that whiskey, and let that cocaine be!" -- Johnny Cash
Re: A 'permanent' keyword [ In reply to ]
On Wed, Nov 10, 2021 at 7:59 PM Ovid via perl5-porters <
perl5-porters@perl.org> wrote:

> Hi Porters!
>
> I would love to see a permanent keyword for Perl. It initializes a
> variable once and only once. It would look like this:
>
> #!/usr/bin/env perl
>
> use 5.38.0;
> use warnings;
>
> sub variables {
> my $name = shift;
> return sub {
> my $my = 1;
> state $state = 1;
> permanent $permanent = 1;
> say "$name: my is $my. state is $state. permanent is
> $permanent";
> $_++ for $my, $state, $permanent;
> }
> }
>
> my $first = variables('first');
> my $second = variables('name');
>
> say "First";
> $first->();
> $first->();
> $first->();
>
> say "Second";
> $second->();
> $second->();
> $second->();
>
> And the output would be:
>
> First
> first: my is 1. state is 1. permanent is 1
> first: my is 1. state is 2. permanent is 2
> first: my is 1. state is 3. permanent is 3
> Second
> name: my is 1. state is 1. permanent is 4
> name: my is 1. state is 2. permanent is 5
> name: my is 1. state is 3. permanent is 6
>
>
> Currently, state's documentation says this:
>
> "state" declares a lexically scoped variable,
> just like "my". However, those variables will
> never be reinitialized, contrary to lexical
> variables that are reinitialized each time their
> enclosing block is entered. See "Persistent
> Private Variables" in perlsub for details.
>
> But that's not quite correct. It's never reinitialized unless the scope is
> dynamic, in which case it is.
>
> Permanent variables would *never* be reinitialized. Not only will this be
> more clear to existing Perl developers, it might help new Perl developers
> who misuse state variables. It might also clear up future issues with
> Corinna, but I won't go there now :)
>

Ultimately, state is equivalent to "a my variable outside the current sub"
and permanent is equivalent to "a my outside the outermost sub" (or a state
inside the outermost sub). They're both useful concepts, but they can also
both already be expressed in the traditional ways.

I'm not sure permanent would be common enough to warrant its own keyword,
but probably we need to make this distinction clearer in the docs.

Leon
Re: A 'permanent' keyword [ In reply to ]
+1 on the documentation suggestion - maybe pull some of the perlsub content
into perldoc -f state, since I think that covers the behaviour pretty well?

If a state variable resides inside an anonymous subroutine, then
each copy of the subroutine has its own copy of the state variable.
However, the value of the state variable will still persist between
calls to the same copy of the anonymous subroutine. (Don't forget that
"sub { ... }" creates a new subroutine each time it is executed.)

If we do add a keyword/CPAN module for this, would suggest `permanent`
isn't ideal - the two concepts I'd expect for that keyword would either be:

- constant
- or refcount of -1

and for me "state but shared between other instances of this CV" would be a
long way down the list of "what might this mean"!

I don't have a better name - `sharedstate` or `singletonstate` maybe.
Re: A 'permanent' keyword [ In reply to ]
On Fri, 12 Nov 2021 at 04:19, Leon Timmermans <fawaka@gmail.com> wrote:

>
> Ultimately, state is equivalent to "a my variable outside the current sub"
> and permanent is equivalent to "a my outside the outermost sub" (or a state
> inside the outermost sub). They're both useful concepts, but they can also
> both already be expressed in the traditional ways.
>

I think the first quoted part in your first sentence would be a super
helpful addition to the docs. Personally I can't stand state variables as I
am never 100% sure how they behave compared to simple my declarations where
the rules are simple enough I can be confident I remember them.

Anyway, better docs on state would be nice.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"