무한 / Infinity in Code
In most languages, an infinite loop is a bug -- a program that never terminates, consuming resources until forcibly stopped. But in event-driven systems, the infinite loop is the foundation: the event loop, the game loop, the render cycle. The program must run forever, continuously checking for input, updating state, rendering output.
while (true) {
processEvents();
updateState();
render();
// never exit. this is the point.
}
The infinite loop is both failure mode and fundamental architecture. Its meaning depends entirely on intention.
A function that calls itself enters a potentially infinite descent. Without a base case, recursion becomes infinite regression -- the stack overflows, the program crashes. But with the right termination condition, recursion transforms complex problems into elegant self-similar solutions.
function infinity(n) {
if (n <= 0) return 1;
return n * infinity(n - 1);
// each call a world unto itself
}
Recursion is controlled infinity -- the infinite made finite through careful constraint.
Lazy evaluation makes infinite data structures practical. A lazy list does not compute its elements until they are needed -- you can define a list of all natural numbers, all prime numbers, all Fibonacci values, and the program simply generates what it needs, when it needs it. Infinity becomes a resource, not a problem.
const naturals = stream(0, n => n + 1);
const evens = naturals.filter(n => n % 2 === 0);
// infinite, yet fits in memory
evens.take(10); // [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
Lazy evaluation teaches a profound lesson: you do not need to possess the infinite to work with it.
Turing proved that no algorithm can determine, in general, whether an arbitrary program will halt or run forever. The infinite is not just present in our code -- it is fundamentally undecidable. We cannot build a tool that reliably distinguishes finite computation from infinite computation. The boundary between the two is itself beyond computation.
Every time you deploy code, you make an act of faith that it will terminate. You cannot prove it. You can only run it and see.