. .

YAPC::EU 2010 - The Renaissance of Perl



Perl 6 Signatures: The Full Story

Perl 6 Signatures: The Full Story

By Jonathan Worthington (‎jnthn‎)
Date: Thursday, 5 August 2010 12:00
Duration: 50 minutes
Target audience: Intermediate
Language: English
Tags: 6 algorithms functional rakudo signatures

A lot of my work in Rakudo over the last year has focused on Perl 6 signatures. At first glance, they seem like a nicer way to get hold of your parameters than manually unpacking @_. Digging deeper, though, they're much, much richer than that: in fact, they're first class, introspectable objects with plenty of applications.

In this talk, we'll start from the basics of writing signatures involving positional, optional, named and slurpy parameters. We'll then take a look at using types, coercions and constraints in order to validate or munge the data that is being passed.

With the preliminaries covered, we'll then dig into nested signatures, which allow us to perform functional programming style pattern matching against complex data structures with the same familiar signature syntax we've already covered. I'll demonstrate how combining this with multiple dispatch allows us to implement several algorithms in the "write what you know and...oh gosh, I have a working program" style.

Finally, we'll take signatures away from the context we've got used to seeing them in - on a sub or method - and see how they can be used to unpack data structures or function return values anywhere else in your program, and used in a given/when construct to branch based on the shape of a complex data structure.

Attended by: Moritz Lenz (‎moritz‎), Clinton Gormley (‎DrTech‎), Smylers, Markus Pinkert (‎Bedivere‎), Steffen Schwigon (‎renormalist‎), Carl Mäsak (‎masak‎), Herbert Breunung (‎lichtkind‎), Sam Vilain (‎mugwump‎), Markus Wichmann (‎telemorphix‎), Ronald Blaschke (‎rblasch‎), Karl Rune Nilsen (‎krunen‎), Alan Haggai Alavi (‎alanhaggai‎), Damian Conway (‎damian‎), David Faux, Andrew Shitov (‎ash‎), Martin Berends (‎mberends‎), Tina Müller (‎tinita‎), Erik Johansen (‎uniejo‎), Leon Timmermans (‎leont‎), Zefram ., Patrick Michaud (‎Pm‎), Florian Ragwitz (‎rafl‎), lorenzo, David Leadbeater (‎dg‎), Olivier Mengué (‎dolmen‎), Aldo Calpini (‎dada‎), Sawyer X (‎Sawyer X‎), Francesco Rivetti (‎oha‎), Jonathan Worthington (‎jnthn‎), Tim Bunce, Dave Rolsky (‎autarch‎), Roman Baumer (‎rba‎), Paul van Eldijk (‎pavel‎), Gabor Szabo (‎szabgab‎), Henrik Andersen (‎HEM‎), simotrone, Mark Morgan, Dagfinn Ilmari Mannsåker (‎ilmari‎), Bernhard Schmalhofer (‎bernhard‎), Stefano Rodighiero (‎larsen‎), Adde Nilsson, Jörg Plate (‎Patterner‎), Nicholas Clark, valerio crini, Leon Brocard (‎acme‎), Lars Holgaard, Bálint Szilakszi (‎szbalint‎), Martin Vorländer (‎mvorl‎), Aristotle, Andreas Vögele, Sébastien Aperghis-Tramoni (‎maddingue‎),

Our sponsors


  • Booking.Com
  • YAPC::Europe 2009
  • cPanel


  • Shadowcat
  • 123 people
  • Venda
  • Dada


  • YAPC::Europe Foundation
  • Smart Open Software
  • MySQL
  • Exonetric
  • pair Networks


  • GitHub
  • Italpro
  • Geoesse
  • $foo Perl Magazin
  • Lokku
  • Apress
  • No Starch Press
  • O'Reilly Media

Media Partners

  • Linux Magazine


  • Regione Toscana
  • Comune di Pisa