Skip to content

Instantly share code, notes, and snippets.

@Xliff
Last active August 30, 2016 04:35
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 Xliff/6fa8e4e6283e8f83fb460a0c708948aa to your computer and use it in GitHub Desktop.
Save Xliff/6fa8e4e6283e8f83fb460a0c708948aa to your computer and use it in GitHub Desktop.

Here's an interesting difference in behavior for rakudo.

Somehow, when I get this, I get the proper MetaModel, which is ClassHOW:

 perl6 -Ilib -e 'unit package ColorTest; INIT { require ::("Color"); }; sub test { ::("Color").HOW.^name.say }; test'

But when I change this into a file, particularly a module, I get something unexpectedly different:

Test.pm

unit package Color::Test

INIT {
        require ::("Color");
}

sub test is export {
        say ::("Color").HOW.^name;
}

The test, and the weird result:

$ perl6 -Ilib -e 'use Color::Test; test'
Perl6::Metamodel::PackageHOW

So what causes the difference in metamodels when we require the Color module in this way?

UPDATE!

Ulps. I managed to reproduce it on the command line, so WTF?

$ perl6 -Ilib -e 'unit package Color::Test; INIT { require ::("Color"); }; sub test { ::("Color").HOW.^name.say }; test'
Perl6::Metamodel::PackageHOW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment