Skip Menu |
Report information
Id: 126341
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: tokuhirom <tokuhirom [at] gmail.com>
Cc:
AdminCc:

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



Subject: STable conflict with .^add_method
Download (untitled) / with headers
text/plain 733b
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 it isn't, perl6-m should show more human readable message.
Subject: STable conflict error isn't very informative
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
On Mon Oct 12 21:21:48 2015, tokuhirom wrote: Show quoted text
> 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. Show quoted text
> 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


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