News for hackers. Stuff that matters.
Re:Laziness Impatience Hubris by lizmat on Tuesday July 14, 2020 @06:11AM (#23830197)
Indeed. That was because smart-matching in Perl was symmetric.

The smart-matching in Raku (formerly known as Perl 6) is asymmetric and customizable. If you write:

    a ~~ b
you are effectively executing:

    b.ACCEPTS(a)
In other words, the right hand side of the smart-match is responsible for accepting the left hand side. So as a developer of a class, you can add your own ACCEPTS (multi-)method to govern how your class will handle smart-matching.

There are no comments on this comment yet.