Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created February 4, 2021 08:03
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 gfldex/b71835bed9fc548e2fd521051d76e45a to your computer and use it in GitHub Desktop.
Save gfldex/b71835bed9fc548e2fd521051d76e45a to your computer and use it in GitHub Desktop.
sub pry(Mu $the-object is raw) {
class :: is Mu {
has $.the-object;
method WHY { 'This is a wrapper for `sub pry` around ' ~ $.the-object.WHAT.gist ~ '.' }
method gist { self.WHY }
method FALLBACK($name) is rw {
say „$name was called“;
use nqp;
nqp::getattr($.the-object, $.the-object.WHAT, '$!' ~ $name)
}
}.new(:$the-object)
}
my \j = (1|2|3);
say j.&pry.WHY;
.say for j.&pry.eigenstates;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment