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
Perl6 Advent Calendar
London Perl Workshop
- The Joy Of Six by Nigel Hamilton
- Perl 6 Grammars by Steve Mynott
- The End Of The Beginning by Jonathan Worthington (closing keynote)
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:
- p5-mop-final-final-v5-this-is-the-last-one-i-promise.tar.gz by Stevan Little
- Write-once Data – Writing Perl Like Haskell by Aaron Crane
- How To Grow A Perl Team by Andrew Solomon
- The Emperor’s New Programming Language by Zefram
- Lightning talks which will most likely also have some Perl 6 related bursts of creativity!
- What One Christmas Elf Has Been Up To by Jonathan Worthington
- Introducing SUPERNOVA by Shimmerfairy
- Perl 6 Is Fun by Dave Rolsky (with a discussion on HN)
- Moar JIT News by Bart Wiegmans
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,
=~=), to do approximate numerical equal with a threshold as defined by the
- Jonathan Worthington fixed several RT tickets by getting the interface to
IO::Socket::Asyncmore 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
Supplymore in line, the
Supply.lastmethod was renamed to
- Tim Toady implemented numeric superscripts, inspired by the short-lived
Operators::Math::Superscriptsby Zoffix Znet. This means that
say 3²will just work and do the right thing (
9for the mathematically challenged).
- Elizabeth Mattijsen implemented
perlseenhelper functions to allow classes to implement a
.perlthat potentially could contain recursive data-structures.
List.firstwill now just give the first element of the list.
List.first(:end)will now just give the last element of the list.
IO::Handle.tnow 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!
- Compress::Brotli by Adriaan Larmuseau
- URI::Template by Jonathan Stowe
- NativeCall::TypeDiag by Sylvain Colinet
- Color by Zoffix Znet
- Path::Coverage by Kamil Kułaga
- PDF::Tools by David Warring
- HTTP::Signature by Pierre Vigier
- WebService::Soundcloud by Jonathan Stowe
- Email::Valid by Demayl
It has been a busy 2 weeks. We’re about to enter December 2015. It’s this Christmas. The tension is mounting 🙂