Constructive Specifications: A Short Story

Constructive Specifications: A Short Story

Or why prosa language specifications are mostly useless

spec·​i·​fi·​ca·​tion (spe-sə-fə-ˈkā-shən)

  1. The act or process of specifying.

  2. A detailed precise presentation of something or of a plan or proposal for something.

Alice is a smart programmer. She has created a programming language called Carta. Other smart programmers have taken an interest in Carta, and they've helped Alice improve the language and its implementation. Then, other smart programmers have played with Carta, and some even started to build things with it. Alice is happy.

Bob is a smart programmer. He has learnt Carta and he likes it, but he wants to build a different implementation. Bob starts building, but he complains to Alice that he doesn't have a specification to work with. "Sure you do, Bob" says Alice. "It's called cartac -its reference implementation- and you've been using it all along." Bob is disappointed. "That's not what I meant. It is a piece of software, not a specification, and it is riddled with bugs."

Alice is a smart programmer, and she knows that language specifications are a legacy from the dark ages of proprietary compilers, when languages didn't have open-source, high-quality, reference implementations. "But Bob, cartac is indeed a specification. In fact, it is a better specification than a .pdf or .html document could possibly be. Its semantics are both human- and machine-readable, respectively as code and as executable. It is constructive, meaning that skeptics will know that implementing Carta is possible. It can not be misinterpreted, as code is precise and exact. It has bugs, though tests can be written and patches can be developed. It will never have the nasty bugs that a natural-language specification has - ambiguities, and contradictions. It is not ambiguous, for software never is. It is never contradictory, for its code would refuse to compile if it were. When bugs are discovered and underspecifications are discovered, we discuss amongst ourselves and develop a patch, just like you would do for a natural-language specification."

Bob is annoyed at this nonsense, but he stops to think for a moment. "Uh, I think I get it." he says. Bob realizes cartac is a constructive specification, and Bob is happy.