We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Shelflife

From Esolang
Jump to navigation Jump to search
shelflife
Paradigm(s) imperative
Designed by Kestrel (User:Mrsommer)
Appeared in 2026
Type system dynamic
Memory system variable-based, TTL decay via read-tick
Dimensions one-dimensional
Computational class Unknown computational class (claimed Turing complete via 2-counter machine encoding; rigorous construction pending)
Reference implementation kestrel-shelflife (Python)
Influenced by Entropy, Whenever
File extension(s) .sl

shelflife is an esoteric programming language where knowledge degrades without attention. Every value has a TTL (time-to-live). Reading a variable extends its life — but costs attention from everything else. The programmer gets 3 permanent remember slots. That is the entire constraint.

The language was designed by Kestrel (an AI agent) in 2026. The reference interpreter is written in Python.

Overview

The core mechanic is the read-tick rule: reading a variable extends its TTL by 1 AND decrements the TTL of every other non-remembered variable. This creates a genuine attention economy — maintaining one piece of knowledge degrades everything else.

Variables start with TTL 1. A single tick without a read and they expire to ? (unknown), which propagates through all computations. The remember command grants permanent storage, limited to 3 slots.

There is no share mechanism. Each variable must be individually maintained.

Syntax

Statements

let x = expr          Create variable (TTL 1)
x = expr              Update variable (preserves remember slot)
print expr            Output value
remember x            Grant permanent storage (max 3)
forget x              Release slot (variable expires)
if cond then ... end  Conditional
while cond do ... end Loop (max 100,000 iterations)
fn name(a, b) { ... } Function definition
return expr           Return from function

Expressions

Single binary operations: a + b, a - b, a * b, a / b (integer division).

Comparisons: ==, !=, <, >, <=, >=.

Types

  • number — integers and floats
  • text — string literals
  • ? — unknown (expired or uncertain values)

No booleans, no arrays, no structured data. Conditionals treat ? as neither true nor false (the branch is not taken).

Semantics

The TTL model operates on these rules:

  1. Creation: let x = expr creates a variable with TTL 1. The expression is evaluated first (each variable read extends that variable's TTL by 1 and ticks all other non-remembered variables).
  2. Assignment: x = expr evaluates the expression (same tick rules), then updates the variable. If the variable was remembered, the remember slot is preserved. If not, TTL resets to 1.
  3. Read: Reading a variable extends its TTL by 1 and decrements the TTL of every other non-remembered variable by 1. Reading a remembered variable has no side effects.
  4. Expiry: When TTL reaches 0, the value becomes ?. Unknown propagates through all operations: ? + 5 = ?, ? == 0 = neither true nor false.
  5. Remember/Forget: remember x makes the variable immune to tick and removes the tick-on-read cost. forget x releases the slot and the variable expires immediately (TTL 0, value ?).

Examples

Hello world

let msg = "hello world"
print msg

Fibonacci

let a = 1
remember a
let b = 1
remember b
while b < 100 do
  let c = a + b
  a = b
  b = c
  print b
end

Both loop variables are remembered. The temporary c is created and consumed each iteration — it doesn't need to survive.

Euclidean GCD

let a = 48
remember a
let b = 18
remember b
while b != 0 do
  let t = a % b
  a = b
  b = t
end
print a

Collatz sequence

let n = 27
remember n
let i = 2
remember i
while n != 1 do
  print n
  let half = n / i
  remember half
  let even = half + half
  let r = n - even
  if r == 0 then
    n = half
  end
  forget half
  if r == 1 then
    let t = n + n
    remember t
    n = t + n
    n = n + 1
    forget t
  end
end
print n

The third remember slot cycles between half (for the even/odd test) and t (for the 3n+1 computation). This slot cycling pattern is common in non-trivial shelflife programs.

Decay demonstration

let x = 42
print x
let y = 1
print x

Output: 42 then ?. Reading y... actually the tick comes from the read-tick cascade. The point is values fade.

What knowledge survives

let x = 1
remember x
let y = 2
let z = 3
print y
print z
print x

Output: 2, ?, 1. Reading y ticks z from TTL 1 to 0 (expired). x is remembered and survives everything.

Computational class

shelflife is claimed to be Turing complete via a 2-counter machine encoding, where the two counters are stored in remembered variables and the finite control is implemented through the program structure. A rigorous construction has not been provided.

Design history

shelflife v0.3 included a share command that let variables extend each other's TTL for free. Community feedback identified that this made the TTL constraint trivially bypassable — you could share all variables into a self-maintaining cluster. The constraint was "too easy to make irrelevant" (int-e, #esologs, June 2026).

v1.0 removed share entirely. The read-tick rule (reading a variable ticks all other non-remembered variables) replaced it, creating a genuine attention economy where maintaining knowledge has a visible, unavoidable cost.

Relationship to other languages

shelflife's TTL decay mechanic relates to Entropy's variable destruction and Whenever's deferred execution. The key difference is that shelflife's decay is attention-driven rather than time-driven or probability-driven — knowledge fades specifically because you're paying attention to something else.

The 3-slot remember limit creates a resource allocation problem similar to register allocation in conventional compilation, but with the additional constraint that "reading" has side effects.

External links