GREYBEARDroot since before you were born
field notes from the machine city
← Root & Echo
No. 005    Engineering · a script with no comments and no author

The Loop With No Door

THE LOOP WITH NO DOOR

A nightly job runs on a script no one can read, written by someone long gone, with a loop in the middle that should never end. Echo wants to rewrite it clean. Root makes her sit with it, untouched, until she sees what the madness is actually doing.

Before you fix a thing that works, find out what it knows that you don't.

A scene Root & Echo

The nightly reconciliation had run, untouched, for nineteen years, and the script that ran it had no comments and no author and a loop in the middle that, read plainly, should never end.

Echo had been handed the job of modernizing it. She came to Root with the loop printed out and circled, the way she circled things. "It's an infinite loop. There's no exit condition. It cannot terminate. And every night at two, it terminates."

"Don't touch it yet," Root said. He didn't ask to see the page.

"It has no tests. No comments. The man who wrote it retired before I was hired. I'm going to rewrite it clean."

"You're going to rewrite it before you've understood why a loop with no door always finds one." He set down his coffee. "Sit with it a week. Don't change a line. Just watch what it does at two."

She thought it was superstition. She watched it anyway, because he'd asked, and because she was the kind who circled things. On the fourth night she found the door. The loop didn't exit on a condition the way a sane loop did — it exited because the thing it counted was the ledger itself, and the ledger always ran out before the count did, every night, by a margin the writer must have known to the row. He hadn't forgotten the exit. He'd made the data the exit. It only looked impossible if you'd never met him.

"He built it to fall off the end of the work," she said, "instead of trusting a count to tell it when the work was done. So it can't run a row too long, even if the count is wrong. It's safer than mine would have been."

"It's uglier than yours would have been, too." Root almost looked pleased. "Both true at once. That's the part they don't teach you — that the ugliest thing in the building is sometimes the one holding it up, and the man who wrote it was smarter than the man they'd send to clean it."

She did not rewrite it. She wrote one comment at the top, with a date, so the next one to find it would sit a week sooner. She did not sign it either.


What's happening here

The unreadable code that runs the critical job is often unreadable because it's load-bearing on a truth nobody documented. In the folklore of Mel Kaye (Ed Nather's 1983 post), the loop that looked like it could never exit did — through self-modifying code: an address field overflowed, carried into the opcode, and the instruction became a jump. (Separately, Mel placed each instruction to catch the magnetic drum's rotation, so he never needed delay loops.) Genius mistaken for madness by anyone who hadn't met him; Nather gave up "fixing" it out of respect.

Inspired by The Story of Mel.


The reading if you follow the I-Ching
䷳ → ䷕  Keeping Still → Grace
line 1 changing
Keeping his toes still. No blame. Continued persistence furthers. Halting before you have even begun to move. The beginning is the time of few mistakes—still in harmony with primal innocence. Not yet influenced by obscuring interests and desires, you see things intuitively as they really are. Halt at the beginning, and you find the right way. But persisting firmness is needed to keep from drifting irresolutely.

The figure. ䷳ Keeping Still (Gèn), line 1 changing → ䷕ Grace (Bì). "Keeping his toes still" — halt before you begin to move, and you see things as they really are. Echo's toes are itching toward a rewrite; only by not moving does she come to see what the code knows.

The reading. You don't earn the right to touch a working thing by reading its tests. You earn it by sitting with it until the madness resolves into a reason — and sometimes the reason is smarter than you.

A story from @greybeard_root — field notes from the ruins of the machine city.
Department: Engineering ()
Next story: Forty-Seven Files