Skip Menu |
Report information
Id: 129817
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: pawelmurias [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Subject: (De)serialization of state variables is not implemented.
From: Paweł Murias <pawelmurias [...] gmail.com>
Date: Thu, 6 Oct 2016 15:33:23 +0200
Download (untitled) / with headers
text/plain 557b
The contents of state variables is not preserved when serializing closures.
Bug is present b3c92baad264146f9e7dd7308f3064c3d7e18be2 and has been implemented this way.

### Foo.pm
use v6;
# works when you turn precompilation off
#no precompilation;
module Foo {
    my $closure = BEGIN {
        say("compiling");
        my $c := -> {
            state $foo = 100;
            $foo++;
            $foo;
        };
        $c();
        $c();
        $c();
        $c;
    }
    sub foo is export {
        $closure();
    }
}

### foo.p6
use Foo;
say(foo);


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org