Commissioned for this museum
A Shape to Fill
English·2023·20 lines·714 bytes
Extract the details of the incident from the report below.
Return a single JSON object and nothing else: no prose before it, no
code fence around it, no trailing commentary.
Use exactly these keys:
summary string, one sentence, under 120 characters
severity one of "low", "medium", "high"
started ISO 8601 timestamp, or null if the report does not say
services array of service names, [] if none are named
cause string, or null if the report does not identify one
Every key must be present in every response. Where the report does not
supply a value, use null or an empty array. Do not omit the key, and do
not infer a value the report does not contain.
---
Report: {{ report }}Curator’s note
A prompt that has stopped asking for an answer and started asking for a value of a particular type.
This is the point in the hall where the medium turns back into programming. Everything above the dashes is a type declaration written in English: five fields, their types, their permitted values, and what stands in for absence. It is doing exactly the job the Store interface does in the lecture on what abstraction costs — naming a shape so that a caller can be written against it before the thing filling it exists.
The instruction that earns its place is the last one. "Do not omit the key, and do not infer a value the report does not contain" is the difference between a parser that works and one that works most of the time. A response missing a key throws; a response with an invented timestamp does not throw, and is worse.
Notice that null is specified rather than assumed. The lecture on null a few rooms away is about a value that inhabits every type and so rules nothing out. Here it is the opposite: absence is declared, per field, in advance, which is what the type systems that fixed null eventually did.
There is no year that anybody named this. 2023 is when the practice settled, roughly, as the tooling around it appeared. The technique is older, because the technique is just having a schema.