Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created December 17, 2012 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/4321746 to your computer and use it in GitHub Desktop.
Save FROGGS/4321746 to your computer and use it in GitHub Desktop.
Merge globals bug in rakudo
module Bar;
multi trait_mod:<is>(Routine $r, :$bar!) is export { }
module Foo;
multi trait_mod:<is>(Routine $r, :$foo!) is export { }
use Foo;
use Bar;
sub a is foo { };
use Foo;
sub a is foo { };
@FROGGS
Copy link
Author

FROGGS commented Dec 17, 2012

Merging global symbols does not work for multi trait_mods.

So if you try to import two trait_mods with different signatures, the program dies rather than add the signatures to the dispatcher list.

First step is to comment out the line 269 in rakudo/src/Perl6/World.pm:

# XXX TODO: Merge handling.
nqp::push(@clash, $_.key);

After that your test script wont die anymore, but you get the trait_mods from perl core and the module you importet last. But you obviously should get the trait_mods from core and both modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment