Nordic Perl Workshop 2009

April 16-17 2009 Oslo, Norway

There's More Than One Way To Dispatch It

There's More Than One Way To Dispatch It

By Jonathan Worthington (‎jnthn‎)
Date: Friday, 17 April 2009 13:30
Duration: 45 minutes
Target audience: Intermediate
Language: English
Tags: 6 multidispatch perl


Multiple dispatch allows you to write many subroutines or methods with the same name, but taking a different number of or different types of parameters. In this talk I will look at multiple dispatch in Perl 6, including:

* How to write multi dispatch subs
* Arity based dispatch
* Basic type-based dispatch
* Candidate sorting - how the winner is chosen in a more complex type hierarchy
* Using subset types to do multiple dispatch on values
* Handling ambiguity: the 'is default' trait and using a proto as a fallback
* The .?, .+ and .* operators

All illustrated with example code, which runs today in Rakudo.


Attended by: Dag Lem (‎dlem‎), Carl Mäsak (‎masak‎), Martin Kjeldsen (‎baest‎), Max Muzi (‎Maxim‎), Florian Ragwitz (‎rafl‎), Erik Johansen (‎uniejo‎), jani, Salve J. Nilsen (‎sjn‎), Marcel Grünauer (‎Marcel‎), geira, Jeremiah Foster (‎jeremiah‎), Leif Egil Olsen, Frank Mortensen (‎FAM‎), Stefan Hornburg (‎Racke‎), Andreas Parslow, Gabor Szabo (‎szabgab‎), Patrick Michaud (‎Pm‎), Edoardo Sabadelli (‎viking-3‎), Håkon Karlsen (‎haakonsk‎), Tore Haugland, Jonathan Worthington (‎jnthn‎), km,