6 ms·
This is secretly about Types and misuse of values. "NV" is a valid value for a plate. The officers were using that value to indicate an error, thus the chaos o
by mabbo 3y ago
This is secretly about Types and misuse of values.
"NV" is a valid value for a plate. The officers were using that value to indicate an error, thus the chaos of error handling for a non-error.
When programming error cases, you should return something that cannot be a valid value. Excellent patterns exist in some languages where a sum type of either a return value or an error can be returned. Optional/Maybe monads to indicate something or nothing. Even, god forgive me for saying this, throwing an Exception is a good way to say "No, not a valid return value".
The traffic wardens paperwork/app needs an explicit field for "Not visible"- ideally one easier to use than writing "NV", rather than a free-form text field that lets them write a value that only they know means something other than a real value.
- rzzzt 3y agoIn-band signaling. They have to agree on an escape character!
- BoppreH 3y agoWouldn't an escape character still be in-band signaling? It should either be something other than a string, like a NULL value, a separate field that says there's no valid plate (and to ignore the string), or have a different type altogether for tickets without valid plates.
- RunningDroid 3y agoAn escape character would still be in-band, but in this context any string containing the escape character wouldn't be a valid plate (In New York any non-alphanumeric character except @ and space would work.)