Awesome work on Raku, thanks Jonathan Worthington!
One kind of dispatch that seems missing, I don’t if it could be applied in Raku, is on the return type. Maybe it would involve too much complications?
Dispatching on return type makes code non-understandable by a human reader.
But could provide a better ergonomic interaction between functions as in Rust. I am thinking about return type polymorphism. I have the fealing that’s in a way it maybe already possible in Raku but have not the knowledge to confirm it.
Perl has something sort of resembling that in the form of “context” (functions can see whether they were called in a context expecting a scalar, a list, or no value at all, and alter their behavior accordingly). One of Raku’s early design goals was to kill that, making functions context-insensitive, and having them return values that might be “multi-faceted” enough to be used wherever they ended up.
If you extend that philosophy, it says you’ll probably never see return type polymorphism in that form. But you can have functions return objects with coercions (“if you try to assign me to a Hash, I’m this; if you try to assign me to an Array, I’m this”); if you assign to the unspecified type, you get the raw object, with all of its potential. Or, more idiomatically, I think, you would just return an object that does both the Positional and Associative roles, which makes it compatible with either kind of subscripting and iteration, without having to transform into a new value.