On Mon Oct 12 21:21:48 2015, tokuhirom wrote: > Here is a code that throws exception. > ``` > #!/bin/bash > > mkdir lib/ > > cat > lib/Child.pm6 <<EOF; > use v6; > use Parent; > > unit class Child is Parent; > EOF > > cat > lib/Parent.pm6 <<EOF; > use v6; > unit class Parent; > > ::?CLASS.^add_method: 'x', method () { }; > EOF > > perl6-m -Ilib --target=mbc --output=lib/Parent.pm6.moarvm > lib/Parent.pm6 > perl6-m -Ilib --target=mbc --output=lib/Child.pm6.moarvm lib/Child.pm6 > > perl6-m -Ilib -e 'use Child' > ``` > > Output is: > ``` > ===SORRY!=== > STable conflict detected during deserialization. > (Probable attempt to load two modules that cannot be loaded together). > ``` > > I guess this code should work(I know it works if i enclose MOP methods > by BEGIN block).
If you want to pre-compile such code, you must put the MOP method call inside of a BEGIN block. Otherwise, it performs the change on each module load, causing the updated class to be serialized into the two downstream modules, and then you get a conflict when trying to load the two versions. > If it isn't, perl6-m should show more human readable message. Yes, we can de-jargon the message somewhat; we'll keep this ticket around for that purpose. Thanks, Jonathan