It seems the dry spell of the Holiday Season has come to an end. Apart from the usual bug fixes and optimizations, and many new tests written or unfudged, the past week saw a few new features, some of them previously unspecced!

Quick way to make an Object (aka Typed) Hash

TimToady++ implemented a new construct:

:{}

As in: create a typed hash that can take Any object as a key without resorting to stringification (which is what the default hashes do). Compare:

say :{ ^10 => 42 }.keys[0].WHAT; # object hash

# (Range)

say { ^10 => 42 }.keys[0].WHAT; # "normal" hash

# (Str)



This work was done as part of making the .classify and .categorize methods create Object Hashes, rather than normal hashes.

Include attributes in suggestion list

hoelzro++ provided a patch that will include names of attributes if an unknown variable is referenced.

class A {

has $!foo;

method a {

$foo = 42;

}

}

===SORRY!=== Error while compiling -e

Variable '$foo' is not declared. Did you mean '$!foo'?



Work behind the scenes

jnthn++ has been busy again, but most of that work is the 6pe branches, so is not visible yet.

6pe = 6model parametric extensions. It’s a small extension to the 6model primitives (that all of our type and OO support is built using) that support parameterized types, including interning of them across compilation units; our inability to do so to date has led to various issues with typed arrays/hashes especially in a pre-compilation setting. The 6pe branches in MoarVM and NQP focus around providing the handful of new nqp::ops that expose this, along with the serialization improvements to go with it. Meanwhile, the 6pe-mop branch in Rakudo is about exploiting these new things to get nice Perl 6 improvements; so far, mixin interning and coercion types, soon typed data structures, and a little later native arrays.

One of the results of this work, is that the 2015.02 release of Rakudo will see coercion types, as in:

sub foo(Str(Any) $x) {

say $x.WHAT

}

foo(42);

# (Str)



Furthermore, mixins will be 10x faster, the CORE settings will be 1MB smaller, and other memory savings.

How to create a Grammar in Perl 6

A very nice article was written by sillymoose++.

The for ^100 { } optimization is restored

Somewhere in the past 2 months, we lost the optimization that speeds up simple loops like:

for ^100 { ... }

This probably happened because of some preliminary work on the GLR. As part of other streamlining work, lizmat figured out what the problem was. After some breakage on the JVM was fixed, this change (which makes these loops about 2.5x as fast) is now functional on every backend again.

Development Allsorts

psch++ did a lot of work on the JVM. raydiak++ spotted that there was no method version of substr-rw. lizmat implemented that, and made it about 3 times as fast. Various other array slice related optimizations / code cleanup were also done by lizmat++. donaldh++ did some amazing work with annotations, and optimizing bytecodes for integer constants 0..5, resulting in a smaller CORE setting.

Signing off for this week

Please let me know of any errors, omissions, additions!