MUMPS (M) Language
MUMPS — the Massachusetts General Hospital Utility Multi-Programming System, now officially just M — is a procedural language with a built-in hierarchical NoSQL database, created in 1966–67 at Massachusetts General Hospital (Octo Barnett, Neil Pappalardo) for medical records on minicomputers with kilobytes of memory. The design inversion that still defines it: there is no separate query language — accessing an in-memory variable and a persistent on-disk value uses the same syntax, so the database is just a kind of variable.
Core ideas
- Globals. Persistent data lives in globals — variables whose names start with a caret (
^cars). A global is a sparse multidimensional tree: any node may hold a value, children, both, or neither, and subscripts are strings or numbers that sort canonically. It is, in modern terms, a hierarchical key-value store with tree-structured keys — JSON-shaped before JSON existed. - Two data types. Numbers and strings. Numbers are stored canonically (leading/trailing zeros stripped, scientific notation normalized); strings use
""as the escaped quote. - Whitespace-aware, terse commands. Commands are case-insensitive and conventionally abbreviated to one letter (
Sfor SET,Wfor WRITE,Kfor KILL,Rfor READ). One space separates a command from its arguments; zero-argument commands take two spaces — an era-specific grammar quirk that survives in production code. - Scoped by convention, not block.
NEWshadows variables; the dot-indented block structure andQUIT-guardedFORloops (as in the Fibonacci example below) give the language its distinctive look.
fib ; compute the first few Fibonacci terms
new i,a,b,sum
set (a,b)=1 ; Initial conditions
for i=1:1 do quit:sum>1000
. set sum=a+b
. write !,sum
. set a=b,b=sumGlobals in action — sparse tree nodes, no schema:
s ^cars=20
s ^cars("Tesla",1,"Name")="Model 3"
s ^cars("Tesla",2,"Doors")=5Where it actually runs
M’s longevity is not nostalgia — it is load-bearing infrastructure:
- Healthcare. The US Veterans Affairs VistA system — one of the largest EHR deployments in the world — is written in MUMPS (via the open-source WorldVistA and the VA’s recent migrations). InterSystems Caché/IRIS (the dominant commercial M descendant) powers Epic’s EHR database layer and much hospital integration middleware.
- Finance. High-throughput transaction processing where the integrated hierarchical store and extreme terseness (a 1970s memory constraint that became an information-density feature) still pay. The open-source GT.M implementation backs real banking systems.
- Why it persists. The same property that made it beginner-friendly in 1966 — one uniform model for memory and persistence, no ORM, no impedance mismatch — is the property modern key-value stores re-discovered; M just never let go of it.
Sources
Related
- common-language-database-stacks — M as an outlier: language and database fused
- common-sql-variables — contrast with the relational/query-language model
- json-web-tokens — JSON, the modern descendant of the tree-shaped data idea