news
Programming Leftovers
-
Marco Roth ☛ Introducing Insta: Snapshot Testing for Ruby
Insta is extracted from Herb’s test suite, where a hand-rolled SnapshotUtils module grew past five hundred lines keeping thousands of parser and compiler tests honest. And it’s a love letter to insta, Armin Ronacher’s snapshot testing library for Rust, whose interactive review workflow this gem brings to Ruby.
-
Ray Myers ☛ C++ Gets Worse Every Year
If you ever get your project to build, you may someday want others to see it. This too is simple! Just hastily scrawl some notes about how it you got it working on your machine. You can rest assured that if anyone else fails to get it working, it is Their Fault (tm). Skill Issue.
-
Hackaday ☛ DOOM Runs (slowly) In A IBM PC-Compatible CSS Sheet
CSS is not a very good programming language. It’s got functions and if statements nowadays, but it doesn’t really do programs in the usual sense. That is, lists of instructions that feed one into another. You can’t change a variable without jumping through hoops. The sort of static behavior you get from a CSS sheet actually matches hardware architecture better than software, which was the key insight [Ahmed] had to make the project possible. It’s still not easy, or elegant, or perhaps even sane, as you can find out from the excellent write-up he has describing how he pulled this off. We particularly like the interactive guide to the full mountain of madness that is the .css file.
-
Kyle Reddoch ☛ Secrets Management 101 for Side Projects
A working secrets-management baseline for side projects: keep credentials out of Git, scope production access, scan before pushing, and respond correctly when a key leaks.
-
Sebastian ☛ i've been thinking about null pointers
which leads to the other weird thing about null. the idea of pointer types in most languages is that a pointer could have any value, except for one, that being the null pointer. but anything else goes. in C in particular, the null pointer is pretty much specified as its own thing with completely different semantics than any other pointer.
-
[Old] Andre Van Der Merwe ☛ Simple Hindley-Milner in Practice
In this post, you’ll learn how to build a lightweight Hindley–Milner type checker in Haskell. No advanced theory is required. We’ll apply it to a tiny, LISP-inspired language so you can focus on how inference works.
Hindley-Milner inference may seem intimidating, but I believe that it is much more approachable than it first appears. Each concept is quite understandable. It is just a matter of working through them and building up to the full picture.
Hopefully, you’ll find this post useful if you want to implement a type system of your own, or if you wish to understand how Hindley-Milner works.
-
[Old] City St George's, University of London ☛ City Research Online - Misconceptions about Loops in C
Loop analysis is a key component of static analysis tools. Unfortunately, there are several rare edge cases. As a tool moves from academic prototype to production-ready, obscure cases can and do occur. This results in loop analysis being a key source of late-discovered but significant algorithmic bugs. To avoid these, this paper presents a collection of examples and "folklore"challenges in loop analysis.
-
Lzon ☛ How C++20 improved the for-loop syntax
Here’s a small piece of syntactic sugar from C++20.
Let’s say I wanted to print out the following: [...]
-
Varun Gandhi ☛ Job queues are deceptively tricky
One of the fun things about being a programmer is that as I look more into systems that I didn’t know much about, what superficially appears to be a simple system actually reveals interesting facets of underlying complexity. In other words, reality has a surprising amount of detail.
In this post, I want to talk about job queues, which I’ve been thinking about for the past few days (and while drafting this post in my head, I realized I’d thought about them for longer at a previous job, but not nearly with as much clarity.)
-
Trần Thành Long ☛ C Strings: A 50-Year Mistake
One design choice in C that now feels outdated—and arguably one of its biggest mistakes—is the use of null-terminated strings. Treating strings as pointers to character “streams” and relying on a terminating NULL character may have made more sense in the 1970s due to the memory and performance constraints of the time, but nowadays there’s basically no reason to keep using it.
The correct modern choice adopted by most newer languages and popular frameworks is length-based strings—basically, a struct with a pointer and a size.
-
Perl / Raku
-
Perl ☛ Three ways to write a table in Podlite
In my previous article I introduced Podlite as a block-based markup language. Today I’ll zoom into one piece: tables.
I write tables in three rough shapes: a few rows of words I’m jotting down, a visual grid like a tic-tac-toe board, or a data export I want to embed in a document. Podlite has three syntaxes around the same model, one per shape. The first has several flavors, so let’s start with that.
-
-
R / R-Script
-
Rlang ☛ Eruption: announcing new R package VolcanoPlotR
Using proteomics, we often want to compare two experimental groups. A popular way to visualise this comparison this is via a volcano plot, where the enrichment of proteins in one condition is towards the right and their de-enrichment (or their enrichment in the other group) is towards the left. The y-axis denotes the p-value of the comparison. Years ago, I wrote an IGOR package called VolcanoPlot, that we have used in our work. For various reasons (see below), I have now ported the package to R.
-