Comment by roywiggins
2 days ago
I ran across SHA1 implemented in MUMPS once. And handwritten bitwise operations, since MUMPS doesn't have those as operators.
2 days ago
I ran across SHA1 implemented in MUMPS once. And handwritten bitwise operations, since MUMPS doesn't have those as operators.
Oof. Unrelated to MUMPS, but the worst I've ever run into was a reimplementation of PHP's register_globals 20 years after it'd been patched out as a security nightmare, because the developer enjoyed the convenience.
One fun thing about MUMPS is that if you don't use the newfangled "new" keyword when declaring them, variables iirc are all global to the file. Or record, or whatever not-quite-a-file entity contains source code in MUMPS systems (8 character hard limit on filenames)
And of course some code ends up relying on ambient global state to function properly, so the codebase is strewn with "environment setting" methods that set up the required globals before you call the functions that rely on them.
The other fun one iirc is that calling a function inside the "true" branch of an IF can clobber the global TEST flag and cause the "false" branch to execute as well, since the "else" keyword relies on $TEST to decide what to do. The fix is to end it with a noop "if true" to unclobber $TEST.
The other worst MUMPS code was MUMPS code that used string concatenation to generate more MUMPS code from the worst DSL you've ever seen, MUMPS code that seemed to partially implement a MUMPS interpreter...