Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created March 16, 2013 13:51
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 jnthn/5176489 to your computer and use it in GitHub Desktop.
Save jnthn/5176489 to your computer and use it in GitHub Desktop.
multi trait_mod:<is>(Routine:D $r, :$randomly_dispatched!) {
$r does role {
method find_best_dispatchee(|) {
self.dispatchees.pick()
}
}
}
proto foo($) is randomly_dispatched { * }
multi foo($x) { say 'omg' }
multi foo($x) { say 'wtf' }
multi foo($x) { say 'bbq' }
foo(1) for ^5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment