Categories

Posts in this category

Thu, 14 May 2009

Custom operators in Rakudo


Permanent link

Last night Patrick Michaud implemented a few nice features in Rakudo: you can now refer to operators by their sub names, define custom operators and overload existing operators.

It comes with a few caveats (precedence levels and associativity are not yet implemented, and some operators that are parrot primitives don't work too well as subs), but all in all it's very nice to see this in action:

sub postfix:<!>(Int $x) {
    [*] 1..$x
}

say 5!;         # 120

"Rakudo: every day a bit more Perl 6". Thanks to all who contributed so far!

[/perl-6] Permanent link

Comments / Trackbacks:

Trackback URL: /blog-en.trackback

Write a comment

 
Name:
URL: [http://www.example.com/] (optional)
Title: (optional)
Comments:
Save my Name and URL/Email for next time