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

STable conflict with .^add_method #4643

Open
p6rt opened this issue Oct 13, 2015 · 3 comments
Open

STable conflict with .^add_method #4643

p6rt opened this issue Oct 13, 2015 · 3 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Oct 13, 2015

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

Searchable as RT126341$

@p6rt
Copy link
Author

p6rt commented Oct 13, 2015

From tokuhirom@gmail.com

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.

@p6rt
Copy link
Author

p6rt commented Oct 14, 2015

From @jnthn

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

@p6rt
Copy link
Author

p6rt commented Oct 14, 2015

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

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant