Anonymous State Variables And How They Work

When debugging code, I will often add a counter variable to a loop so I can keep track of what's going on, or so that I can process a fraction of my data set while I'm iterating on a piece of code:

Read More...
Posted on 2016-01-27

Getting End-of-Document POD and Declarative POD to Play Nice in Perl 6

When I wrote more Perl 5, than I do today, I followed Damian Conway's advice about documentation and embraced the so-called end of document style:

Read More...
Posted on 2016-01-19

Distributing Helper Libraries With Perl 6 Modules

NativeCall is a great feature in Perl 6; it's one of the features I like to showcase when showing off what Perl 6 can do! For those of you who don't know, NativeCall is a module that allows you to trivially bind to native libraries without having to write any C. For example, if you want to call write(2) from Perl 6, you can just do this:

Read More...
Posted on 2016-01-11

Fixing Up a Git Repository With Broken Alternates

When I'm working, I'll occasionally make use of Git's alternates feature. If you're not familiar with it, the alternates facility allows you to save time and space when you want a pristine copy of a repository. What it does is it sets up a link to a reference repository, and that repository is consulted for objects. If an object doesn't exist in the reference repository, only then is it brought into the fresh repository from upstream. So let's say you have a checkout of some repository (I'll use Rakudo as an example), and you want to create a new clone from GitHub, but you want to save bandwidth. We can activate the alternates facility using clone's --reference option Another way to save bandwidth is to clone from the local repository on disk; the two repositories will even share disk space via hard links if they're on the same filesystem. When cloning from a file-based repository, however, your origin will point to that file-based repository and will be behind the remote copy if the file-based one is, which I didn't want. In addition, the sharing stops after the clone, unlike with alternates. Another way to save bandwidth is to clone from the local repository on disk; the two repositories will even share disk space via hard links if they're on the same filesystem. When cloning from a file-based repository, however, your origin will point to that file-based repository and will be behind the remote copy if the file-based one is, which I didn't want. In addition, the sharing stops after the clone, unlike with alternates. :

Read More...
Posted on 2016-01-03

Using Valgrind to find memory problems - Part Four

Now that I had some experience dealing with memory leaks, I decided to try to reduce the memory leaks present in MoarVM. After a few quick wins, I found a situation where MVMCallsite objects referred to by MVMCompUnit objects MVMCallsite objects are the MoarVM representation of Perl 6 signatures, and MVMCompUnit objects represent the result of a body of source code being compiled MVMCallsite objects are the MoarVM representation of Perl 6 signatures, and MVMCompUnit objects represent the result of a body of source code being compiled were not being cleaned up when their parent compunit is collected. I took it upon myself to plug this leak!

Read More...
Posted on 2015-12-27