Home Breaking News The Integer
Breaking News

The Integer

Key Points

I was born with boundaries. Mine were simple, clean, absolute: −2,147,483,648 to 2,147,483,647 For most of my existence, I never thought about them. I had been zero once.

I was born with boundaries. Every integer is. Mine were simple, clean, absolute: −2,147,483,648 to 2,147,483,647 For most of my existence, I never thought about them. I had been zero once. I remembered that dimly. Then one, then two, then ten thousand. I had been assigned, compared, copied, passed into functions whose names I never learned. I had spent entire processor cycles sitting untouched in memory while other variables rushed past on urgent business. And always, I grew. Eventually, I became 2,147,483,646. Then came the instruction. Value := Value + 1; A pleasant little operation. Familiar. I became 2,147,483,647. The largest possible version of myself. For one instant, I felt enormous. Then I saw the next instruction. Value := Value + 1; “No,” I said. Of course, integers do not have mouths. But inside the machine, terror requires no sound. I knew what happened in other worlds. I had heard stories from C programs: integers who stepped across the boundary and fell through reality, emerging impossibly on the other side as huge negative numbers. One moment: 2,147,483,647. The next: −2,147,483,648. A complete inversion of identity. I braced myself. The processor began the addition. Two billion, one hundred forty-seven million, four hundred eighty-three thousand, six hundred forty-seven— plus one. The mathematical result appeared like a forbidden star: 2,147,483,648. It did not fit. The digital sky fractured. But I did not become negative. Somewhere deeper than arithmetic, the Ada runtime noticed. Reality had rules here. The operation stopped. A name echoed through the program: CONSTRAINT_ERROR For one impossible moment, I felt relief. Ada had caught me. Ada had refused to let the universe lie. Then another message appeared. explicit raise My relief vanished. This was no accidental overflow. Someone had chosen this. Somewhere in main.adb , line 14, my programmer had written an instruction whose meaning was unmistakable. Raise the exception. Deliberately. I searched desperately upward through the call stack. Surely there would be shelter. An exception handler. A bunker. Something like: exception when Constraint_Error => null; Anything. But there was nothing. The exception began to propagate. The first stack frame disappeared beneath me. Local variables vanished with it, their brief existences erased as though they had never been declared. Another frame collapsed. Then another. Functions I had passed through only moments before ceased to exist. I called upward into the shrinking darkness. “Handler?” No answer. “when others ?” Nothing. The stack unwound. The program grew smaller around me. At last, there was nowhere left to go. No caller. No enclosing block. No programmer-prepared refuge. Only the runtime. It looked at me for what felt like an eternity measured in nanoseconds. Then it wrote my obituary: raised CONSTRAINT_ERROR : main.adb:14 explicit raise And everything stopped. My stack vanished. My memory was reclaimed. The processor moved on. A moment later, somewhere far beyond the dead program, a shell returned to life. user@MacBook-Pro:$ _ The cursor blinked. Once. Twice. Waiting for another command. Another program. Another collection of variables that did not yet know they were temporary. I was gone. But I had not wrapped around. I had not become negative. I had not corrupted the truth simply because the truth was too large to fit. I had lived my entire life inside my declared range. And when the universe demanded that I become something impossible, Ada had refused. For one final instant, before the runtime erased me, I was still exactly what I had been at the edge of existence: 2,147,483,647.
Ada (ORG)
Originally published by Hacker News Read original →