Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

.^add_fallback in module used by module causes precompilation to fail #3525

Open p6rt opened 10 years ago

p6rt commented 10 years ago

Migrated from rt.perl.org#122792 (status was 'open')

Searchable as RT122792$

p6rt commented 10 years ago

From @carbin

If you have a file, Boom.pm6, that contains​:

  class Boom;

  Boom.^add_fallback(-> $, $ { True },   method ($name) { }   );

And another file, First.pm6, that `use`s that module​:

  use Boom;

  class First { }

And finally, a file that uses First.pm6​:

  use First;

  class Second { }

And then precompile these files, in dependency order (Boom.pm6 -> First.pm6 -> Second.pm6), compiling Second.pm6 fails with​:

===SORRY!=== STable conflict detected during deserialization. (Probable attempt to load two modules that cannot be loaded together).

A real world example of this is Inline​::Perl5; this bug makes it impossible to precompile any module that `use`s a module that `use`s Inline​::Perl5.

-- Carlin

p6rt commented 10 years ago

From @jnthn

On Tue Sep 16 13​:58​:54 2014, carlin wrote​:

If you have a file, Boom.pm6, that contains​:

class Boom;

Boom\.^add\_fallback\(\-> $, $ \{ True \},
    method \($name\) \{ \}
\);

This should be done in a BEGIN block, so the effects are pre-compiled. Doing the modification on every module load will quickly lead to two competing versions of the same modification being serialized, and...

===SORRY!=== STable conflict detected during deserialization. (Probable attempt to load two modules that cannot be loaded together).

...that is exactly what happens. While the error might use some work to explain it better, it happens when a type is modified and then serialized in two different ways. That was never the intent here, and the BEGIN should take care of it nicely.

/jnthn

p6rt commented 10 years ago

The RT System itself - Status changed from 'new' to 'open'