Commissioned for this museum

A Shape to Fill

English·2023·20 lines·714 bytes

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.

Elsewhere in the museum