Raku mixins have two (or more) natures, combining several values in the same container, or values along with roles. However, there is not, as far as I can tell, a straightforward way to check for "mixinity" in a variable that has not been created by you.
This might be a trick
my $foo = 3 but Stringy;
say $foo.^name ~~ /\+/;# OUTPUT: «「+」»
But is there any other property I'm missing that would allow to look this up directly?
I think you're missing the ^roles
and ^parents
meta-methods:
my $foo = 3 but Stringy;
dd $foo.^roles; # (Stringy, Real, Numeric)
dd $foo.^parents; # (Int,)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With