Sunday, 29 November 2026

Skink-lang update: generics that actually work, a ternary, and a Pi that finally talks to its own pins

When I introduced Skink back in June, I described it, with what I thought was admirable restraint, as a language for people who are tired of choosing between a robot that crashes into the skirting board and a robot that stops to have a think about its feelings first.

Since then, DANI has got bigger, heavier, and — I am reliably informed by the dent in the skirting board — no easier to stop. Skink has had to keep up. Version 0.2.121 is out now, and most of what has changed since June falls into one of two categories: things that should have worked all along, and things I only realised were broken when I tried to use them for something real.

Here is the honest version of both.

Generics finally mean it

This is the big one, and also the one I am least proud of having to fix.

Skink has had generics for a while — Box<T>, Stack<T>, that sort of thing — but under the old scheme, every type parameter was quietly lowered to an i8*, a pointer-sized slot, regardless of what you actually put in it. Which is fine if you are storing pointers. It is considerably less fine if you are storing, say, an actual integer, or a slice, or anything else that is not pointer-sized and does not appreciate being squeezed into a pointer-shaped hole.

The result was a class of bugs that were, to use the technical term, maddening. Code that looked right, type-checked fine, and then produced the wrong values at runtime. I had a pair of compile-fail fixtures in the test suite specifically for this, which is the compiler equivalent of putting a traffic cone over a hole in the floor and calling it fixed.

As of 27 November, generic declarations are monomorphised: the compiler now generates a specialised copy for each concrete instantiation. Box<int> and Box<string> are genuinely different types, with genuinely different layouts, and a []T field actually carries the real element type.

struct Box<T> {
    buf: []T

    fn Get(self: *Box<T>, i: int) -> T {
        return self.buf[i]
    }
}

fn NewBox<T>(n: int) -> Box<T> {
    return Box<T>{buf: make([]T, n)}
}

That used to be a wish. It now works, including for generic methods, methods with their own type parameters, and two-parameter types like Pair<K, V>. The compile-fail fixtures are gone. I have deleted the traffic cone and filled in the hole.

The Pi gets proper pins

The other headline is hardware, and it is the one DANI cares about most.

Skink's GPIO support now talks to Linux properly: the GPIO v2 character-device ABI (/dev/gpiochipN), with Pi header identification for the Pi 5's RP1 southbridge, the Pi 4's BCM2711, and the older BCM2835 boards, plus PWM mapping for the right pins on each. There is a legacy sysfs fallback for older setups, and — my favourite part, because it means I can test things without unplugging a robot — an in-memory workstation backend, so the same code runs on a laptop with no Pi attached at all.

The I2C and SPI modules got the same treatment. Which matters, because DANI's vision stack is a K210 talking over I2C, and I would rather find out my pin code is wrong on my desk than find out from the sound of a robot driving into a wall.

In practice, the code you write has not changed much. It is the code underneath it that has stopped lying to you:

err := gpio.Setup()
sensor_pin := gpio.PinFactory(17)
sensor_pin.SetInput()

It just does what it says on the tin now, on every Pi I own, instead of on the one Pi I happened to test it on.

A tiny thing I somehow missed: the ternary

Skink now has a ternary operator:

label := x > 0 ? "pos" : "neg"

I know. A ternary operator, in late 2026. I can hear you. In my defence, Skink already used ? for something else — postfix error propagation, as in value := mightFail()? — so adding cond ? a : b meant teaching the parser to tell the two apart: a ternary is only a ternary when an expression follows the ? and a : completes it. The tests now cover nesting, precedence, call arguments, returns, and — crucially — the fact that error propagation still works exactly as before.

It is a small feature. It is also the kind of small feature that makes code noticeably shorter, which is why I am slightly embarrassed it took this long.

Stop hand-writing JSON boilerplate

Relatedly, and in the same spirit of "things that should have been easier": structs can now be marshalled and unmarshalled without manually passing type metadata around.

Previously, turning a struct into JSON meant spelling out the reflected type and a raw pointer yourself. Now the compiler injects that at the call site, and you just write what you meant:

s, err := json.Marshal(&u)
err = json.UnmarshalInto(s, &u)

That works for JSON, YAML, and XML, including nested structs, slices, pointers, and field tags — so a field called name in Skink can be full_name on the wire, without a hand-written conversion function in between. The reflection metadata underneath got a proper expansion at the same time, including field addresses, so the ORM and the serialisers are finally reading from the same book.

If you have ever written a ToJson function that was longer than the struct it serialised, this one is for you.

Windows, or: I now support the operating system I don't use

Skink now cross-compiles for Windows, with a proper installer, documented setup, and fixes for the two things Windows loves to punish you for: path normalisation and process argument quoting.

I do not run Windows day to day. This means every Windows fix in this release was found the hard way, usually by a test failing in a way that made no sense until it suddenly, horribly, did. The release workflow, the linker detection, the build_windows.sh script — all of it is now considerably less of a polite fiction.

If you are a Windows user: it should just work now. If it does not, I would genuinely like to know, preferably before I have to set up a Windows machine to reproduce it.

The security bit I wasn't going to mention

I should probably mention the security hardening, if only because pretending it didn't happen would be worse.

In October, Skink went through a proper hardening pass: string bounds checks, arithmetic overflow checks, recursion caps, fixes for file-descriptor exhaustion, signal-handler corruption, predictable temp files, and an exec race on Windows. Twenty-eight issues in total, found with AddressSanitizer and a certain amount of staring at code until it confessed.

The file that listed them, VULNERABILITIES.md, has now been deleted, because there is nothing left in it to list. That is the best kind of file deletion I have ever performed, and I intend to enjoy it for at least a week.

The encrypt module picked up RSA signing and verification, and AES-GCM with additional authenticated data, in the same pass. Your secrets are now secrets in a much more literal sense than they were before.

The smaller things, in one breath

A few more, because a release note that only lists the big items would be lying by omission:

  • Embedded filesystems: embed "dir" lets you bake a directory into a binary, with int: path routing.
  • An ORM: std/orm maps structs to SQLite tables, with struct field tags exposed through reflection.
  • fn main(args: []string): programs can now take command-line arguments like a normal language, which I realise sounds like it should have been there from the start. It should have been.
  • skinkcov: coverage reporting is now part of the release packaging, so I can no longer pretend the tests cover the bits they don't.
  • Scales and skinkjs: the package manager and the JavaScript transpiler are now part of the standard install flow, rather than things you had to go and find.
What next

The honest answer is: more of the same, but smaller. Generics and GPIO were the two big load-bearing fixes; what remains is mostly polish, more standard-library coverage, and — inevitably — whatever DANI breaks next. He is very good at finding the gaps in a language. It is, I have decided, a feature, not a bug. He is my most thorough tester, and he works for electricity and the occasional charging dock.

If you try 0.2.121 and something breaks, tell me. If you try it and something doesn't break that used to, tell me that too — I could use the encouragement.

curl -fsSL https://raw.githubusercontent.com/markoxley/skink/main/install.sh | bash

Let's get skinking.


Skink 0.2.121, 27 November 2026. The compiler is written in Skink itself, the standard library is 65+ modules, and the skirting board is, at time of writing, still standing.

No comments:

Post a Comment

Aiming for Jarvis, Creating D.A.N.I.