Perl 6 Signatures: The Full Story

By Jonathan Worthington (‎jnthn‎) from Bratislava.pm
Date: Sunday, 13 June 2010 11:50
Duration: 40 minutes
Target audience: Intermediate
Language: English
Tags: 6 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 your parameters than manually unpacking @_. Digging deeper, 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 coerce the data that is being passed.

We'll then look at nested signatures, which allow us to perform functional programming style pattern matching against complex data structures. We do this using the same familiar signature syntax we've already covered. I'll demonstrate how combining this with multiple dispatch allows us to implement several algorithms very neatly.

Finally, we'll look at how signatures 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:

Venue

GL-club

Sponsors

Регистратор доменных имен РЕГ.РУ

REG.RU — аккредитованный регистратор доменных имен, хостинга, почты, VPS. Каждый третий домен в России регистрируется через REG.RU.

uCoz.ru

uCoz — крупнейший в РуНете конструктор сайтов. Проект, созданный на Perl и ищущий новых людей в свою команду — rabota.ucoz.ua.

Organizer

DeepText
Perl Mova + YAPC::Russia 2010