Skip to content

Instantly share code, notes, and snippets.

@Mouq

Mouq/FooBar.p6 Secret

Created November 9, 2014 04:18
Show Gist options
  • Save Mouq/427aad1a5a3817b765ea to your computer and use it in GitHub Desktop.
Save Mouq/427aad1a5a3817b765ea to your computer and use it in GitHub Desktop.
slang FooBar;
role Grammar {
token baz { }
}
role Actions {
token baz { }
}
=becomes
package FooBar {
role ...
role ...
sub EXPORT {
my \HOW = $*LANG<MAIN>.HOW;
nqp::bindkey(%*LANG, 'MAIN', HOW.mixin(%*LANG<MAIN>, Grammar));
nqp::bindkey(%*LANG, 'MAIN-actions', HOW.mixin(%*LANG<MAIN-actions>, Actions));
{}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment