What a year, right? I had a whole load of blog posts planned for 2020, a talk to prep for YAPC, but the Lord decided that He had a better plan. I don’t know that anyone is going to read this, but I want to take some time to process what happened to the technical arm of it along the way. The biggest change to my life technically is that I don’t think I have written more than a dozen edits to a Raku program in the last 15 months.
I recently had some friends ask me to describe my work-journal, so here we go. I am here giving a snapshot of my current journaling practices. When it comes to organization, I am not very consistent. In fact, between the first draft and publishing, I changed some of the details already. So, let’s hurry this up before I change something more drastically. The Tools I keep two separate journals: one for work and one personal.
One of the earliest modules I wrote for Raku (then Perl 6) was ArrayHash. ArrayHash is basically a Hash that preserves key insertion order. I don’t remember what I originally wrote it to do, but I do still use it in one application I use every year or so to help me with a complicated task at work. I don’t actually think the work itself is very interesting, but you might learn some bits about Raku internals through my work, so I hope this is useful to someone.
I am going to be honest and upfront with you. I have almost no opinion about the name change of Perl 6 to Raku. I can see going to war for something meaningful, like religion. I cannot imagine doing so for something trivial, like a programming language. I won’t be upset if you call my hammer a mallet. There are certainly advantages and disadvantages to the name change, but as far as I’m concerned, it was inevitable as long as the issue kept being brought up year after year.
First, I want to say thank you to Andy Lester who has been project lead on vim-perl6 as well as the other contributors, especially Hinrik Örn Sigurðsson, Rob Hoelz, and Patrick Spek. The plugin will now be homed in the new Raku organization on github here: https://github.com/Raku/vim-raku As of right now, it has been updated such that it will handle the old Perl 6 filenames as well as the newer ones, so far identified as .
I hope this calendar has been of some use to you all. In any case:
Lots of big words in the title. In simpler terms, it means running a program in the background and interacting with it as input and output becomes available. The tool in Raku for doing this work is called Proc::Async. If you’ve ever dealt with the pain of trying to safely communicate with an external process, writing to its input and reading from its output and error streams and hated it, I think you’ll like what Raku has built-in.
Raku actually provides two different locking classes. A Lock object provides a very standard locking mechanism. When .lock and .unlock are used or .protect is called, you get a section of code that pauses until the lock frees up, runs while holding the lock, and then frees the lock so other code that might be waiting on the lock can run. However, the Lock class works in such a way that blocks the current thread.
What’s more asynchronous than socket communication? When two programs need to talk to each other, often from different computers on different networks in different parts of the world, you can connect using a socket. Whether an HTTP server or some custom protocol, you can implement both sides of that communication using IO::Socket::Async. Let’s consider a simple calculator service. It listens for connections over TCP. When a connection is established, it takes lines of input over the connection and parses each line as a simple mathematic calculation like 2 + 2 or 6 * 7.
Iteration is slow. If you have N things to process in a loop, your loop will take N iterations to process. Slow. Sometimes that’s the only way, though, to solve a problem. For example, let’s consider the case where we have a JSON log and we want a command to read each line, parse the JSON for that log, and summarize it showing the time stamp and message: use JSON::Fast; my $log-file = 'myapp.