Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(De)serialization of state variables is not implemented. #5730

Open
p6rt opened this issue Oct 6, 2016 · 1 comment
Open

(De)serialization of state variables is not implemented. #5730

p6rt opened this issue Oct 6, 2016 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Oct 6, 2016

Migrated from rt.perl.org#129817 (status was 'new')

Searchable as RT129817$

@p6rt
Copy link
Author

p6rt commented Oct 6, 2016

From pawelmurias@gmail.com

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant