Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

masak (6289)

masak
  (email not shown publicly)
http://masak.org/carl

Been programming Perl since 2001. Found Perl 6 somewhere around 2004, and fell in love. Now developing November (a Perl 6 wiki), Druid (a Perl 6 board game), pls (a Perl 6 project installer), GGE (a regex engine), and Yapsi (a Perl 6 implementation). Heavy user of and irregular committer to Rakudo.

Journal of masak (6289)

Sunday November 29, 2009
05:59 PM

November 29 2009 -- drowning in workarounds

[ #39961 ]

228 years ago today, the crew on board the slave ship Zong murdered 133 Africans by dumping them into the sea, in order to claim insurance.

The resulting court case, brought not by the authorities as a mass-murder charge against the ship-owners, but as a civil action by the ship-owners seeking compensation from the insurers for the slave-traders' lost "cargo", was a landmark in the battle against the African slave trade of the eighteenth century.

The term "Zong Massacre" was not universally used at the time. It was usually called "The Zong Affair," the term "massacre" being used mainly by those considered to be "dangerous radicals," as late eighteenth-century politics stood. At the time, the killing of slaves—individually or en masse—was not considered to be murder, at least legally. In English law, the act was completely legal and could be freely admitted to the highest court in the land, without danger of prosecution. The publicity over this case was, however, one of the factors that led to the legal situation being completely changed within a few decades.

Despite the long way we've come since then, I hear slavery is bigger than ever, in absolute numbers, in our day.

Today I decided to find out why GGE::OPTable was emitting warnings. When writing that class and inadvertently introducing those warnings, I had the intuitive feeling that they were not my fault, so to speak, but the result of a yet-undiscovered rakudobug.

I was right. It was a spooky-action-at-a-distance bug where a declaration of a postcircumfix .{} operator in one file caused Rakudo to report a completely innocent variable declaration nested deeply inside another file as being a redeclaration, when in fact it wasn't.

Postcircumfix .{} is notoriously difficult to get right. It already had two bugs to its name before today. It clashes syntactically with not only blocks, but sometimes even with itself! 哈哈

I wouldn't care about a warning which I didn't cause and which would go away as soon as the rakudobug in question is fixed, if it weren't for the fact that when Rakudo emits warnings during precompilation, it generates broken PIR files. So, by working around the false warning bug, I could precompile my module files, which would help make the Glacial Grammar Engine slightly less glacial at startup.

But... uh. Uhn. GGE is big. Because it's the declaration of the postcircumfix .{} operator that's triggering the bug, I needed to remove that declaration and all its usages. How does a use of that method look? Well, like a normal hash access. That's the point of declaring it in the first place!

Hash accesses aren't really searchable. They can look like .{} or like .<> (most often without the dot, of course), but even worse, they are hidden behind many hash accesses on other objects (mostly hashes), which also look like that. This is one of the times where non-strict typing does not really help. So there was a lot of manual inspection involved, to separate the goat hash accesses from the sheep hash accesses.

In the end, all you can really do is replace all the occurrences you find by eye, run the tests and see where things fail, insert loads and loads of debug statements to find out how far into the code the execution reaches before things blow up, finally finding the offending hash access. It is the pure masochism in this kind of work, along with the fact that I haven't heard others complain a lot, which makes me think that I am indeed writing some of the most complex stuff out there in Rakudo right now. Either that, or I'm simply doing it wrong. 哈哈

I got partially there. In order to be able commit and push something today, I shunted my work off in a branch. Here it is. Will merge as soon as all the old tests pass again.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Well, as it turns out, there wasn't much work left. unobe++ found some typos that I'd made when translating, almost exactly when I found them myself. After I'd re-enabled errors catching again, all the old tests pass, so now I've merged.

    Next up: trying to precompile, and committing a Makefile.

  • Postcircumfix .{} is notoriously wrong to get right.

    :-)

    • ...well, isn't it? :)

      Thanks. The slippage in question was divine punishment for me not doing the requisite proofing before posting. Now corrected.

  • And so is sin hard to make beautiful when its loathsomeness is exposed to the light.

    Thanks Carl for reminding me that any crime can be dressed up and justified by the right combination of self interest and heartlessness.

    Don't think for a moment that the new order in a certain European nation didn't find it strange to re-classify a group of humans as untermenschen.

    And remember who cheered the loudest at the enacting of the 1933 enabling act: the students and the professors at the Universities - the great