Hi there,

I've been looking around to see if there's been any discussion of
introducing functional programming-style pattern matching for method/
function dispatch.  Could someone point me to any such discussions?

I've seen that perl6 is taking on a lot of ideas from the functional
world (lazy evaluation for instance).  With multi-method dispatch on
the agenda pattern matching seems inevitable but I haven't been able
to find information about this or any related discussions.

This is a contrived example of what I'm referring to:

sub traverse([Leaf $a]) {
  # do something
}

sub traverse([Tree $left, Tree $right]) {
  traverse($left);
  traverse($right);
}

my $t = Tree(...);
traverse($t);

---

Many thanks!

Reply via email to