It has been a busy two weeks. It’s getting harder and harder to keep up. So here we are with two weeks of goodies! Let’s first get some of the shorter items on the road:
Rakudo Star 2015.11 (Now In Beta!)
Moritz Lenz made sure we have another good starting place for people interested in trying out Rakudo Perl 6!
A New Perl 6 Introduction
Naoum Hankache has created another excellent online Perl 6 Introduction. Most of the comments on Hacker News were quite positive. Weird! :-)
Perl6 Advent Calendar
Jonathan Scott Duff wrote the the introduction to this year’s very special Perl 6 Advent Calendar. Be sure to check out a new blog post every day until Christmas!
London Perl Workshop
Quite a few Perl 6 related presentations at the London Perl Workshop on 12 December 2015:
Several other presentations appear to be interesting from the Perl 6 point of view as well, although they do not appear to be about Perl 6:
And now, for the more in-depth,
code related happenings:
Jonathan Worthington hooked one of the last remaining bits of the GLR into the language: array shapes. That means you can now say:
my @a[3;3] = 1..3, 4..6, 7..9;
# [[1 2 3] [4 5 6] [7 8 9]]
Since the system knows the shape of this two dimensional matrix, it can give good error messages:
# Index 4 for dimension 1 out of range (must be 0..2)
Apart from making this feature well performant (which will not happen on this side of Christmas, as Jonathan Worthington points out in his blog post), there are still some features to be filled in:
# Partially dimensioned views of arrays not yet implemented. Sorry.
This just means we have more to look forward to! :-)
Pre-Compilation Returns To Panda
Or in other words: The Curli Has Landed.
About a month ago Jonathan Worthington wrote a gist describing some of a design for better module management and pre-compilation. Since then, Stefan Seifert has been working on implementation of this design in the curli branch. It was felt that that work has sufficiently advanced to merge it back into the main branch, which happened yesterday. This now means that e.g. the standard core modules such as Test.pm and NativeCall.pm are now pre-compiled and installed as any other module from the ecosystem.
This also brings back pre-compilation to modules installed with panda. At the moment of this writing, there are still some rough edges being worked on, but things are looking good for Christmas in that respect. This should also make it (finally) possible to have multiple versions of the same module installed at the same time!
There was one casualty with this change:
@*INC is no longer with us, but
$*REPO is! I’m pretty sure we will see an advent post about what this all means soon!
A side effect of this merge, is that the bare startup time of Rakudo has dropped with about 10% to around .105 seconds. So, kudo’s to Stefan Seifert for hanging in there and unwind this gnarly set of issues to make Rakudo Perl 6 ready for the future!
Small Supply Refactor
While Jonathan Worthington was working on some Supply related Christmas RT tickets, he realised there was a logic error in the way a Supply can be made from another
my $mapped = $supply.map will give you another
Supply $mapped. This
$mapped is supposed to only get emitted values from the original
$supply, but technically it would be possible to also emit values on
$mapped yourself. And this creates all sorts of logic and composability issues. With Christmas this close, it was decided it would be better to bite this bullet now, rather than have to deal with this after Christmas. So a small refactor was done, which basically splits off the functionality of a
Supply you can
emit on, to a new
Or, as Jonathan Worthington described in the original commit message:
Supply is now much more like Seq, in that it’s a container around a large number of implementations. Those implementations now do the Tappable role. Tapping a Supply still returns a Tap, but now it only has a .close method. A Supply no longer has a list of taps; it’s just something that can be tapped. This allows for far cleaner and more efficient implementation of the Supply combinators. More importantly, it removes the design issues that rogue code could in theory take any Supply and emit values into it.
Creating an on-demand Supply is now the role of a separate class, at present called Supplier. A Supplier has a Supply method to obtain a Supply. The Supply can be tapped many times, and the Supplier used to emit/done/quit to all those tappers (thus making it the typical way to do live supplies). Code can therefore expose a Supply, but keep the right to publish values to itself, which will be more robust.
The on meta-combinator is gone, in favor of using supply blocks. Some of the built-in combinators using on have been rewritten in terms of Supply blocks. A number remain to be refactored.
Finally, the notion of serial and sane supplies has been introduced. A serial supply promises it’ll never emit more than one value at a time. A sane supply promises it’ll follow the Supply protocol, that is [emit* [done|quit]], and in addition implies serial. All of the built-in combinators provide sanity; Supplier also enforces this, but does provide an escape hatch just in case. This simplifies the implementation of many combinators, and will also help prevent a number of situations that existed before where it was all too easy to write code using supplies that had data races.
So, now you can no longer
emit to a
# Method 'emit' not found for invocant of class 'Supply'
Note that you create a
Supply by coercing a
Supplier. This also means you can no longer say:
my $s = Supply.new;
# Cannot directly create a Supply. You might want:
# - To use a Supplier in order to get a live supply
# - To use Supply.on-demand to create an on-demand supply
# - To create a Supply using a supply block
But as you can see, you get a very nice error message instead. The few people already using
Supply, only had to do marginal fixes, and in many cases could simplify their code because of this small refactor.
Other Noticeable Happenings
- Tim Toady added an approximately-equal operator,
infix:<≅> (Texas version
=~=), to do approximate numerical equal with a threshold as defined by the
$*TOLERANCE dynamic variable.
- Jonathan Worthington fixed several RT tickets by getting the interface to
IO::Socket::Async more in line. He also fixed a number of spurious data loss issues with async sockets.
- Elizabeth Mattijsen implemented
Range.rand, to give you a random number within the given
- To bring the
Supply more in line, the
Supply.last method was renamed to
- Tim Toady implemented numeric superscripts, inspired by the short-lived
Operators::Math::Superscripts by Zoffix Znet. This means that
say 3² will just work and do the right thing (
9 for the mathematically challenged).
- Elizabeth Mattijsen implemented
perlseen helper functions to allow classes to implement a
.perl that potentially could contain recursive data-structures.
List.first will now just give the first element of the list.
List.first(:end) will now just give the last element of the list.
IO::Handle.t now works on MoarVM: it indicates whether the handle is opened on a TTY (which is tech-speak for: is there any person watching this?).
- Arne Skjærholt is still looking for people help him on the IPerl6 kernel project. There is some Low Hanging Fruit there that is just waiting for someone to be plucked!
It has been a busy 2 weeks. We’re about to enter December 2015. It’s this Christmas. The tension is mounting :-)