Tombstone
Kira (KiraProject)
May 2008 – Aug 2008 · age 26
What it was
A statically typed, OCaml-flavoured language that compiled to PHP 5, written in one summer. Kira had tuples, structural records, enums as sets, function types, test blocks with asserts, and database blocks whose select expressions were typed as row arrays. PHP lacked closures and block scope, so the compiler invented both: closures became generated classes holding their captured variables, and blocks saved and restored shadowed names. A companion schema DSL, MassSHARD, declared tables, shard groups and views, and exported typed contracts the language imported. Marking a function api produced a PHP RPC dispatcher, a JavaScript client stub and a documented test page. The demo compiled at 23:45 on August 17, 2008. Enums never lexed, and for loops emitted no body.
Wins, for the age
- At twenty-six, compiled closures into PHP classes a year before PHP 5.3 (2009) shipped them natively. A primate gave PHP a feature its own authors had not shipped.
- Routed queries to their shard at compile time by intersecting
wherekeys with the schema's shard maps, two years before Vitess (2010). - One
apikeyword generated the server dispatcher, the client stub and a test harness, three years before Swagger (2011) popularised generated API stacks. - Type-directed SQL escaping chosen by the compiler: parameterisation by construction.
What it taught
- Type systems are design tools: structural subtyping and numbered type errors shaped the language.
- Compiling to a worse language means inventing each missing feature, and each invention is an essay on what the target lacked.
- Schema and code from one source: typed contracts exported by the schema compiler and imported by the language became a lasting pattern.
- Test the lexer when adding a token, and emit the loop body. The demo was the only test, and it showed.
Genealogy
Ancestors: Career Brkz Rednova: the startup PHP this language was invented for. HUROX: a site's server and client compiled from one source. Jove 3: the web-application compiler rewritten as a language. Jovian Katana V1: generated PHP, JavaScript and parameterised SQL from one design. Descendants: Adama Language: a typed language where schema and behaviour share one file. Adama Saas: one definition generating servers, clients and docs. Lamancha II: the next language to compile tables and types into a runtime.
Epitaph
Here lies Kira, OCaml's types over PHP's runtime, with one keyword that made a server, a client and a test page. It compiled its demo at 23:45 on a summer night, and the enums never worked.