On Error Resume Next, PLEASE
Over the past several articles, we've explored the stranger corners of PHP, JavaScript, Python, C#, Java, and, of course, Perl. Especially Perl.
We've encountered variables that lie, loops that corrupt data, compilers that enthusiastically approve terrible decisions, and programming languages that seem to regard predictability as an optional feature.
But there's a problem. We've barely scratched the surface of programming-language insanity. The history of software development is littered with languages that introduced ideas so peculiar they deserve to be preserved in a museum.
Some were brilliant. Some were genuinely useful. Some were products of their era. And a few appear to have been designed by people who were actively trying to make programmers suffer.
So, before we retire this series, let's visit eight languages that didn't get their own articles. The also-rans. The honorable mentions. The programming-language equivalent of the drawer where you keep mysterious cables (and more-magic switches) because you're afraid to throw them away.
1. VBScript: What if We Just Ignored All the Errors?
Let's start with one of Microsoft's more memorable contributions to defensive programming. VBScript.
For a generation of Windows administrators and web developers, VBScript was a familiar tool for automation, Active Server Pages, and various tasks that nobody particularly wanted to perform manually. It was lightweight, accessible, and closely related to Visual Basic.
And it had a magnificent approach to error handling.
On Error Resume Next
Yes. On error. Resume next. Not "handle the error." Not "log the error." Not "recover gracefully." Just continue.
Consider:
On Error Resume Next
x = 1 / 0
WScript.Echo "Everything is fine!"
Output:
Everything is fine!
We divided by zero. And the program carried on. No exception bubbling up to interrupt execution. No dramatic crash. Just an application confidently proceeding as though nothing had happened.
To be fair, VBScript wasn't entirely reckless. It provided an Err object that programmers could inspect after an operation to determine whether something went wrong. You were supposed to check Err.Number, handle the failure, clear the error when appropriate, and continue.
And you could disable the behavior with:
On Error GoTo 0
But the language also made it perfectly possible to put On Error Resume Next near the beginning of a procedure and effectively turn error handling into a philosophical question. Did the operation succeed? Who knows? Did the program continue? Absolutely.
This was especially entertaining in Windows automation, where scripts might interact with files, COM objects, network resources, and other components capable of failing in ways that were anything but obvious.
The lesson: Sometimes the most dangerous error-handling strategy is one that makes the errors disappear. VBScript's motto might as well have been: "If we don't acknowledge the problem, is it really a problem?"
2. Go: Please Format This Date Using January 2, 2006
Go has a reputation for simplicity. Minimal syntax. Straightforward tooling. A deliberate resistance to unnecessary language complexity. And a rather distinctive approach to date formatting.
In most programming languages, date formats use tokens. Something like:
YYYY-MM-DD HH:mm:ss
Or perhaps:
yyyy-MM-dd
The exact syntax varies, which is annoying, but the general idea is familiar. You describe which components of a date you want.
Go looked at that and decided to do something different. In Go, you format a date by writing an example of what a particular date would look like. And that particular date is:
Mon Jan 2 15:04:05 MST 2006
Not today's date. Not the Unix epoch. Not the beginning of the Gregorian calendar. January 2, 2006, at 3:04:05 PM, in a timezone seven hours behind UTC.
Why? Because the components form a memorable numerical sequence:
- Month = 1
- Day = 2
- Hour = 3 (12-hour clock)
- Minute = 4
- Second = 5
- Year = 6 (2006)
- Timezone = 7 hours west of UTC
So if you want to format a date as year-month-day, you write:
t.Format("2006-01-02")
If you want hours, minutes, and seconds:
t.Format("15:04:05")
And if you want a complete timestamp:
t.Format("2006-01-02 15:04:05")
This is actually rather clever. Instead of memorizing whether uppercase M means month or minute, you memorize one reference date. But it creates some wonderfully counterintuitive code.
Because in Go:
"2006-01-02" is a formatting specification.
While:
"YYYY-MM-DD" is essentially just a literal string.
Imagine discovering that after spending an hour wondering why every timestamp says YYYY-MM-DD.
The truly delightful part is that Go's own source documentation describes the American month-before-day convention used by the reference date as a regrettable historical error. So even the people responsible for this design are willing to acknowledge that part of it is unfortunate.
The lesson: Go simplified date formatting by inventing an entirely different way to think about date formatting. Which, depending on your perspective, is either brilliant or a small act of aggression.
3. COBOL: What if GOTO Could Change Its Mind?
COBOL has an unfair reputation. People make fun of its verbosity, its age, and its tendency to resemble an accounting department's attempt to invent English. But COBOL was built for serious business computing. Banks. Insurance companies. Payroll systems. Financial transactions. Applications where getting the answer right was rather important.
Which makes one of its historical features particularly entertaining. Meet ALTER.
ALTER ROUTER TO PROCEED TO SECOND-OPTION.
What does this do? Well, imagine you have a paragraph containing a GO TO statement:
ROUTER. GO TO FIRST-OPTION.
Ordinarily, executing ROUTER transfers control to FIRST-OPTION. But after executing that ALTER statement, subsequent executions of ROUTER transfer control to SECOND-OPTION instead.
You've changed the destination of a GOTO at runtime. The original source code still says:
GO TO FIRST-OPTION.
But the program no longer goes there. Because some other part of the program changed its mind.
This is not simply changing a variable used by a conditional branch. Historically, the semantics were described in terms of altering the executable branch itself.
Now imagine debugging a large business application. You find a paragraph that clearly says GO TO FIRST-OPTION. But the program goes somewhere else. You check the source. You check the debugger. You question your career choices.
Eventually, you discover that 800 lines earlier, another paragraph executed an ALTER. And now the program's control flow depends on which historical path led to the current execution.
This was a real COBOL feature, not a parody. It was classified as obsolete in the COBOL 1985 standard and excluded from later standards, although some implementations retain support for compatibility. The GnuCOBOL documentation even strongly discourages its use because of its disastrous effects on readability and debugging. Which is a rather polite way of saying: "Whoever thought this was a good idea should be required to maintain it."
The lesson: GOTO was already controversial. COBOL found a way to make its destination negotiable.
4. Common Lisp: Would You Like That Number in Roman Numerals?
Common Lisp is one of the most powerful and expressive programming languages ever designed. It has macros, dynamic typing, multiple dispatch through CLOS, sophisticated condition handling, and an extraordinary ability to extend itself.
But today, we're going to ignore all that. Because Common Lisp can turn numbers into English words and Roman numerals using its ordinary string-formatting function.
Consider:
(format nil "~R" 42)
Result: "forty-two"
That's right. The formatting function just spelled out the number. Now add a colon:
(format nil "~:R" 42)
Result: "forty-second"
An ordinal number. Now add an at-sign:
(format nil "~@R" 42)
Result: "XLII"
Roman numerals. And now both:
(format nil "~:@R" 4)
Result: "IIII"
Old-style Roman numeral notation.
Let's review. Common Lisp's standard formatting system knows how to produce cardinal English numbers, ordinal English numbers, modern Roman numerals, and additive Roman numeral notation. And you select among them using combinations of punctuation characters.
Why? Because apparently formatting numbers in decimal, hexadecimal, and binary wasn't ambitious enough.
To be fair, Common Lisp's format facility is astonishingly sophisticated. It can perform conditional formatting, iteration, justification, and many other operations that would require substantial code in simpler formatting systems.
But I particularly enjoy the fact that some language designers apparently sat down and decided that support for Roman numerals belonged in the standard output formatting facility. Not a third-party library. Not a cute example in a tutorial. The actual language standard.
The lesson: Common Lisp is so powerful that even its string formatter has features most languages would implement as entire libraries. And the next time someone complains that Common Lisp has too many parentheses, remind them that it can produce XLII without importing anything.
5. ObjectPAL: What if SQL Were an ASCII-Art Project?
Let's revisit a largely forgotten corner of desktop database development. Borland Paradox. And its programming language, ObjectPAL.
Paradox was a serious competitor in the desktop database world, particularly during the DOS and early Windows eras. It provided tables, forms, reports, and a powerful query system. And one of its most distinctive features was Query by Example, or QBE.
Instead of writing SQL statements, users could build queries by filling out table-shaped grids. That was the visual interface. Fair enough.
But here's the wonderful part. Those queries could also be represented as text files containing ASCII-style table grids. And ObjectPAL could execute them.
A simplified illustration of the format looks something like this:
Query CUSTOMER.DB| Name| Balance |
| Check | >100|
EndQuery
This is a schematic example of the grid format, rather than a ready-to-run saved query. But the important part is real. Paradox QBE files used rows, columns, field names, selection criteria, and markers such as Check to describe what should be returned.
You could save a query to a .QBE file. And ObjectPAL could load and execute it. Which means a database query could literally resemble a tiny spreadsheet drawn with vertical bars.
Now imagine trying to construct one dynamically. In ObjectPAL, you could build the query text programmatically. Including the column separators. And the line breaks. And the field names. And the selection criteria. All while maintaining the structural layout the query parser expected.
So instead of writing a conventional query expression, you could find yourself concatenating strings to construct something resembling an ASCII-art table. And if the grid was malformed, Paradox could complain about inconsistent columns.
I particularly love this because it captures an era when visual database tools were trying to make querying accessible to ordinary business users. And sometimes succeeded brilliantly. But when programmers needed to automate those same systems, they inherited the visual metaphor.
The lesson: ObjectPAL could make a database query look less like programming and more like formatting a table in a terminal. To be fair, Query by Example was a genuinely important idea originating at IBM Research in the 1970s, and Paradox didn't invent it. But Paradox's text-based QBE representation deserves a special place in programming history. SQL asks what data you want. Paradox occasionally asked whether you could draw it.
6. dBASE: Your Variable Can Become Part of the Program
While we're visiting desktop databases, let's talk about dBASE. dBASE and its descendants, including FoxPro and Clipper, helped define an entire generation of business application development. They were database systems and programming environments rolled into one. And they provided some extraordinarily flexible mechanisms for working with data.
One of my favorites is macro substitution. Consider:
STORE "CUSTOMER" TO mFile
USE &mFile
The & operator substitutes the contents of the variable into the command. So the second line effectively becomes:
USE CUSTOMER
That's convenient. You can select which database file to open dynamically. But it doesn't stop there. In traditional dBASE dialects, macro substitution could be used to construct field references, expressions, and even commands dynamically.
For example:
STORE '? "Hello from a variable"' TO mCommand
&mCommand
The substituted command is executed. Your variable just became executable program text. And in some dBASE implementations, the expanded statement could be recompiled at runtime.
This is an extraordinarily powerful mechanism. It's also the kind of feature that can make static code analysis rather challenging. Because the actual command being executed might not appear anywhere in the source code in its final form. Instead, it gets assembled from strings at runtime.
Sound familiar? Yes, modern languages have eval, dynamic SQL, reflection, and other forms of runtime indirection. But dBASE made macro substitution a natural part of ordinary application development. The ampersand was effectively a little doorway between data and program text.
And as every security engineer will tell you, blurring that boundary creates interesting opportunities. Some good. Some considerably less good.
The lesson: dBASE didn't merely allow variables to contain values. It allowed variables to participate in writing the instructions the computer would execute. Which is fine until your data decides it would rather be code.
7. MUMPS: Put a Caret in Front of a Variable and It Becomes a Database
Now we arrive at one of the terrifying languages in computing history. (Not THE most terrifying, we'll get to that next). MUMPS. Also known as M. Develope
Comments
No comments yet. Start the discussion.