Comment by lgessler
3 years ago
Used to write MUMPS at a certain company, and there were lots of "wtf" moments but this is one I'm particularly fond of. In the system, all dates are represented as an integer starting from an arbitrarily defined earliest date represented as 0, December 31, 1840 (http://www.mumps.cz/gtm/books/pg/UNIX_manual/webhelp/content...). OK, fine, whatever. But another fact about MUMPS is that associative arrays (= Python dictionaries, or Java maps) are automatically sorted. Weird language feature, and probably a questionable one, but also on its own, not the worst thing in the world.
However, these two facts put together mean that date-keyed associative arrays are always ordered from earliest to latest, and for reasons that I've forgotten, it was at least at one point inefficient to use the MUMPS facilities for reverse traversal of the associative arrays.
The solution? Defining another date format, which is `121531 - $d` where `$d` is a value in the standard MUMPS date representation. This was then used instead of or alongside the standard representation for indexing associative arrays.
Practically, this was a huge hazard for code correctness as you needed to be absolutely sure of which format the date number was in. This additionally marks Monday, September 27, 2173 as the festive occasion of date sorting doomsday, as it is the date on which the secondary format would cross over into negative values and probably start causing all kinds of subtle bugs throughout the system. Let's hope we will have moved on to better systems by then!
Say you worked at epic without saying you worked at epic.
Ha! I was going to say the article clearly referencing Epic.