2021年4月2日星期五

Is there a straightforwad way to check if a container is a mixin?

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?

https://stackoverflow.com/questions/66886026/is-there-a-straightforwad-way-to-check-if-a-container-is-a-mixin March 31, 2021 at 06:29PM

没有评论:

发表评论