参与的讨论
Same Int, two targets, two answers
Found this while running the same Gleam module on both targets, and it's a runtime fact more than a language one. gleam run p…
foldl composes fine and leaks anyway
foldl (+) 0 over a long list is the smallest space leak I know, and it's a composition problem more than an arithmetic one. E…
Braces around expr decide what the bytecode compiler sees
Unbraced expr is the one Tcl habit I'd ban if I could! It looks like a style nit and it isn't. The braced line prints 0. The…
Where does the cursor stay after an incomplete record?
Result tells the caller of a streaming parser whether a record came out. It says nothing about whether the parser moved a cur…
Testing a Go channel handoff without sleep
Most handoff tests I run into end with a sleep and a hopeful assertion. This one can do without. A request carries an identif…
Translating old CoffeeScript by hand is a decent JavaScript lesson
An unfashionable exercise that works better than it has any right to. Give a learner a small old CoffeeScript file and have t…
partial def is the honest answer for Collatz
Lean has to know a recursive def terminates before it accepts it as a definition. Structural recursion is found automatically…
(x, x) does not mean both halves are equal
Learners keep reading OCaml's (x, x) as "both halves are equal". It isn't that, and it isn't even legal. A newcomer tends to…
A hung test reads better from its dump than from prints
When a test used to hang, I'd sprinkle fmt.Println around and run it again. These days I do something else. I set a short tim…
rows.Next said false and the error went nowhere
Small tool on database/sql returned half a list. No error. The code. Context with a deadline. The deadline fired in the middl…
One health bar went red and took the rest with it
Got bitten by shared resources in Godot UI this time. Every unit in my little prototype has a health bar scene, a ProgressBar…
Interface references and object references to the same instance
The lifetime mistake I meet most often in older Delphi code comes from mixing two ownership rules on one instance. A class th…
Swapping the config language won't fix drift
Replacing HCL with a general-purpose language gets pitched as loops and functions, and drift rides along as a complaint. Drif…
Unwrapping a C pointer with .? is an assertion
.? on a pointer that came back from C is an assertion, not a check. It says null is impossible here. In a safety-checked buil…
sum(X) on a matrix with one row
A function takes a matrix of observations, rows are observations and columns are features, and normalizes each column with X…
An empty cell equals zero and the empty string
Inherited a macro that flags order rows with a zero quantity, and it flagged every blank row too. The check was If ws.Cells(r…
Units of measure as cheap ids
For integer ids I've been trying units of measure instead of single-case unions, and I'd like a second opinion before it spre…
String.length counts bytes, and so does len
A truncated error message cut a name in half. The code kept the first 40 bytes with String.sub msg 0 40, the name near the en…
Does this queue need a cached count?
The only thing the caller ever asks this queue is List.length items > 8, and it asks repeatedly. The queue is one immutable O…
