Skip to content

Instantly share code, notes, and snippets.

View nunorc's full-sized avatar

Nuno Ramos Carvalho nunorc

View GitHub Profile
diff --git a/src/multi-dispatch.pod b/src/multi-dispatch.pod
index 67ce236..eb07595 100644
--- a/src/multi-dispatch.pod
+++ b/src/multi-dispatch.pod
@@ -144,12 +144,22 @@ this to count how often a type check occurs:
=end programlisting
-The first counter output is always C<0>, since the nominal types alone already
-determine which candidate matches best, so the where-block is never executed.
rakudo$ cat constrains.p6
use v6;
my $counter = 0;
multi a(Int $x) {};
multi a($x where {$counter++; True}) {};
a(3);
say $counter;