Luke Palmer wrote:

All this Haskell programming has opened my eyes to what our multimethod
dispatch could be. As we have seen with C<sort>, the dispatch system is
a pattern matcher. But it's a pretty terrible one.


I think we should replace our multimethod system with a more general
pattern matcher, a "variadic multimethod" system of sorts.  Multimethods
need to be variadic anyway, because we want pugs's quicksort example to
work.

Here's my proposal:

Inside an argument list, the first mention of a variable introduces its
binding.  Later arguments require a match.  We can now define 'equal':

   sub equal ($x, $x) { 1 }
   sub equal ($x, $y) { "" }

That's one of the MTOWs at least.  The evaluation order of the patterns
still needs to be thought out.



I thought Larry already declared that we are not making Perl act like ML (yet).

-- Rod Adams




Reply via email to