gears

The DC Baltimore Perl Workshop took place this past weekend. It was a one day event followed by a one day hackathon. On Saturday, there were two tracks, one mainly focused on Perl 5, and the other on Perl 6. On Sunday, quite a few people stayed for the hackathon which made for an interesting time with lots of different projects and interesting discussions. I find that workshops are a great way to have a lot of hands on experiences and one-on-one conversations that go deeper into issues than is often possible at a conference.

John Anderson started off Saturday’s sessions with a summary of the current state of Perl 5 drawing comparisons to the Perl of 1999. Some things I remember were: metacpan is the new search.cpan.org, Plack and Dancer are the new CGI.pm (I would add Mojolicious), and new forums and newsletters like prepan and Perl Weekly are shaking things up.

I moved up to the Perl 6 track after that where, after a mini install-fest, Brock Wilcox led the room in a game of “Randori” – an exercise in which one person is at a laptop, another one directs the person at the laptop, and the rest of the room acts as the choir, helping the director tell the programmer what to do. We did this exercise as a way to learn Perl 6, and the 15 of us tried to write a program to do word wrapping. It was a lot of fun, and I think everyone learned something new.

I was sorry to miss David Golden’s talk about Practical Consistency, though I was able to talk to him about it at the hackathon on Sunday. He deals with interesting problems at MongoDB and discussed practical interpretations of the CAP Theorem. Talking with him helped me better understand the trade-offs of a distributed storage system I helped design a while ago (namely that we wanted to guarantee write availability, which is unusual: most systems have to guarantee read availability).

After lunch Will “Coke” Coleda talked about nativecall and parallelism, concurrency and asynchrony. He referenced a previous talk by jnthn on the same topic. He included a great example of using the race operator to run something across multiple CPUs in batches. (There is an order-preserving variant called hyper) :

1
2
my @nums := 1..1000;
my @tens = @nums.race(workers => 10, batch => 5).map({ $_ * 10 });

Later in the day during the lightning talks, Mario Roy described how he had dedicated his life to making something in Perl 5 – MCE and had a very similar example:

1
2
3
MCE::Map::init { max_workers => 10, chunk_size => 5 }
my @nums = 1..1000;
my @tens = mce_map { $_ * 10 }, @nums;

I then gave my talk about writing a simple web application in Perl 6.

I went down to the Perl 5 track after that where I learned from Dylan that bugzilla is quite alive and that there are over 6000 active installations of it. I spend so much time on github these days that I often forget that not everyone in the world wants to use a proprietary closed system for bug tracking.

After Graham talked about how Alien builds bridges across ecosystems, there were lightening talks. In addition to the ones above, a memorable one was David Golden’s smokin’ git rebase which described a technique for making all commits green when doing a rebase -i. I also encouraged everyone to try out a game of Rock Paper Scissors, which was built with websockets and a Perl backend and a React frontend.

During the hackathon on Sunday I went down a deep Perl 6 rabbit hole. It went like this:

  1. Perl 6 has comments like this that can be attached to the objects proceeding or preceding them:

    1
    2
    3
    4
    5
    
    class X {
        #| This is a comment about foo
        has $.foo;
        has $.bar;  #= This is a comment about bar.
    }
    
  2. The Perl 6 metaobject model makes it possible to find these doc strings for attributes.

  3. I had written a documentation server which used these cool features. Unfortunately, while the first form of comment was working, the second one was not.

  4. Coke showed me how to clone Perl 6 and run the spec tests and find the unit tests related to that feature and potentially find the problem in the code.

    1
    2
    3
    4
    5
    6
    7
    
    git clone -o github http://github.com/rakudo/rakudo
    cd rakudo
    perl Configure.pl --gen-moar --backends=moar
    make spectest
    # This gets the repository http://github.com/perl6/roast
    # Now to run an individual test, you can do, e.g.
    make t/spec/S26-documentation/block-trailing.t
    

    The last step can be done with just perl6 instead of make but then you won’t skip tests that are flagged as tests to be skipped by rakudo.

  5. Brock had written LREP which allowed me to drop into a REPL loop (like Ruby’s pry) while Perl 6 code is running.

  6. Combining forces I was able to get together a failing test which showed the problem.

This was kind of amazing, and really drove home one of the design goals of Perl 6 – to let mere mortals participate in the evolution of the language. Though I haven’t been able to fix the original problem, at least it seems approachable.