Created
February 4, 2021 08:03
-
-
Save gfldex/b71835bed9fc548e2fd521051d76e45a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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