The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Syntax::Feature::Function - Provides a function keyword

VERSION

version 0.002

SYNOPSIS

    package Foo;
    use syntax 'function';

    fun curry ($orig, @orig_args) {
        fun (@args) { $orig->(@orig_args, @args) }
    }

    curry(fun ($n, $m) { $n + $m }, 2)->(3); # 5

    1;

DESCRIPTION

This library uses the syntax dispatching mechanism to activate the functionality provided by Function::Parameters.

Keyword Naming

By default, a fun keyword will be provided. There are various ways to change the name and number of function keywords that will be provided.

Using a different name

    use syntax function => { -as => 'f' };

The above example would provide a function declaration keyword named f instead of fun. So you could say

    f foo ($n) { 2 * $n }

and

    f ($n) { 2 * $n }

for anonymous functions.

Multiple function declarators

    use syntax function => { -as => [qw( f fun )] };

This usage will provide you with both keywords: f and fun. They will both work the same way.

METHODS

install

Called by syntax to install the function declarator keyword into the requesting package.

SEE ALSO

syntax, Function::Parameters, Devel::Declare

AUTHOR

Robert 'phaylon' Sedlacek <rs@474.at>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Robert 'phaylon' Sedlacek.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.