Starting with this week, I plan mentioning changes in Perl 6 and its implementations just so you will know what to expect, so you could update your code and use new features in your code to simplify old logic.
@array-of-hashes»<key> which recursively iterated hash values in array.Str.capitalize was deprecated and will be removed in Rakudo 2012.11. You’re expected to use Str.wordcase instead.require now returns module it has imported.List.duckmap. This method evaluates expression for every element. If map function will give undefined value, List.duckmap is applied recursively to every element if it’s list.List.deepmap. It works like List.map, except it’s recursive when element has Iterable role.-foo => 'bar' form is now allowed in Perl 5 part of grammar.${0}, $(-1) is not recommended instead as replacement anymore.$^N now recommends $[*-1] instead of $-1.$|++.Str.wordcase was implemented.
{*} can be used in proto to run actual code.
# Memoize function
proto complex-calculation($argument) {
state %cache;
%cache{$argument} //= {*};
}
multi complex-calculation (Int $argument) {
rand + $argument;
}
The first matching constrained candidate rule for multi-dispatch is now used instead of returning error. This causes is default to be optional in cases like this:
multi sub fizzbuzz(Int $ where * %% 15) is default { 'FizzBuzz' }
multi sub fizzbuzz(Int $ where * %% 5) { 'Buzz' }
multi sub fizzbuzz(Int $ where * %% 3) { 'Fizz' }
multi sub fizzbuzz(Int $number ) { $number }
(1 .. 100)».&fizzbuzz.join("\n").say;
infix:<X> is now somewhat faster.
Perl 5 regexes now can match non-alphanumerics without a meaning as literal characters and \B (not a boundary) is now implemented correctly.
run doesn’t throw exceptions on Windows platforms.
General performance improvements in NQP thanks to implementing lexical natively typed variables.
$variable.Str when $variable is Mu shows “use of uninitialized $variable of type Mu in string context” as it should instead of confusing “Method ‘VAR’ not found for invocant of class ‘Mu’” error message.