Constraints are apparently not used to select one in a multi
multi sub cuenta( Str $str ) { say $str };
multi sub cuenta( $file where .IO.e ) { say $file.IO.slurp };
cuenta( $*PROGRAM-NAME ); # Outputs the file name
That means it's using the first multi, not the second. However, this works as intended:
subset real-files of Str where .IO.e;
multi sub cuenta( Str $str ) { say $str };
multi sub cuenta( real-files $file ) { say $file.IO.slurp };
cuenta( $*PROGRAM-NAME );
printing the content of the program itself. This probably says something about type checking and multi scheduling, but I'm not sure if it's by design or it's just a quirk. Any idea?