DEV Community

Cover image for On Error Resume Next, PLEASE
Jean-Luc Martel
Jean-Luc Martel

Posted on

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
Enter fullscreen mode Exit fullscreen mode

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!"
Enter fullscreen mode Exit fullscreen mode

Output:

Everything is fine!
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Or perhaps:

yyyy-MM-dd
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

So if you want to format a date as year-month-day, you write:

t.Format("2006-01-02")
Enter fullscreen mode Exit fullscreen mode

If you want hours, minutes, and seconds:

t.Format("15:04:05")
Enter fullscreen mode Exit fullscreen mode

And if you want a complete timestamp:

t.Format("2006-01-02 15:04:05")
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

Is a formatting specification.

While:

"YYYY-MM-DD"
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

What does this do?

Well, imagine you have a paragraph containing a GO TO statement:

ROUTER.
    GO TO FIRST-OPTION.
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

Result:

"forty-two"
Enter fullscreen mode Exit fullscreen mode

That's right.

The formatting function just spelled out the number.

Now add a colon:

(format nil "~:R" 42)
Enter fullscreen mode Exit fullscreen mode

Result:

"forty-second"
Enter fullscreen mode Exit fullscreen mode

An ordinal number.

Now add an at-sign:

(format nil "~@R" 42)
Enter fullscreen mode Exit fullscreen mode

Result:

"XLII"
Enter fullscreen mode Exit fullscreen mode

Roman numerals.

And now both:

(format nil "~:@R" 4)
Enter fullscreen mode Exit fullscreen mode

Result:

"IIII"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

The & operator substitutes the contents of the variable into the command.

So the second line effectively becomes:

USE CUSTOMER
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

Developed in the 1960s, MUMPS became particularly influential in healthcare information systems.

And unlike some of the deliberately obscure languages we'll encounter, MUMPS has powered serious, mission-critical applications.

Including systems handling patient data, hospital operations, and enormous amounts of clinical information.

Which makes its approach to data storage particularly fascinating.

Consider:

SET PATIENT(42,"NAME")="Alice"
Enter fullscreen mode Exit fullscreen mode

This sets a local variable with subscripts.

Fine.

Now add one character.

SET ^PATIENT(42,"NAME")="Alice"
Enter fullscreen mode Exit fullscreen mode

That caret changes everything.

The variable is now a global stored in the system's persistent database.

Not merely a process-local variable.

A database-backed structure that can survive program termination and be accessed by other processes with access to the same database environment.

Read it back:

WRITE ^PATIENT(42,"NAME")
Enter fullscreen mode Exit fullscreen mode

Output:

Alice
Enter fullscreen mode Exit fullscreen mode

MUMPS globals are hierarchical, persistent, multidimensional structures.

You can use subscripts to organize data into tree-like arrangements.

And the database is deeply integrated into the language.

No separate ORM.

No SQL statement required.

No explicit database connection for every basic operation.

Just a caret.

This is a different programming model from the one most modern developers know.

In a typical contemporary application, the distinction between application memory and persistent storage is fundamental.

You have variables.

You have a database.

And you write code to move information between them.

MUMPS decided those concepts could live much closer together.

Which is genuinely elegant.

But also somewhat alarming to programmers accustomed to variables disappearing when a process exits.

Consider the sentence:

"I changed one variable, and now every application using that database can potentially see the change."

In MUMPS, that's not necessarily a bug.

That's how the architecture is intended to work.

Of course, real systems provide database environments, access controls, transactions, and other mechanisms that determine what can be accessed and modified.

But the core idea remains extraordinary.

The lesson: In MUMPS, the difference between an ordinary variable and persistent shared storage can be a single punctuation character.

And you thought Perl had an unhealthy relationship with punctuation.

8. INTERCAL: Your Compiler Would Appreciate Some Manners

We've saved the best for last. Well, "best".

Because until now, every language we've discussed was trying, in its own peculiar way, to solve real programming problems.

INTERCAL had a different objective.

Created in 1972 by Don Woods and James Lyon, INTERCAL was designed as a parody of programming languages.

Its name was short for:

Compiler Language With No Pronounceable Acronym.

Which is already a promising start.

The language deliberately rejected conventional design choices.

Its syntax was intentionally strange.

Its control flow was deliberately hostile to intuition.

And it included instructions such as IGNORE, FORGET, and ABSTAIN.

But my favorite feature is its requirement for politeness.

In INTERCAL, statements can be introduced using keywords such as:

DO
Enter fullscreen mode Exit fullscreen mode

Or:

PLEASE DO
Enter fullscreen mode Exit fullscreen mode

And here's the fun part.

In traditional INTERCAL implementations, your program needs to contain enough PLEASE statements to satisfy the compiler.

If fewer than roughly one-fifth of your statements use the polite form, compilation fails.

With an error like:

PROGRAMMER IS INSUFFICIENTLY POLITE
Enter fullscreen mode Exit fullscreen mode

Which is wonderful.

But it gets better.

If you use PLEASE too often, the compiler also complains.

PROGRAMMER IS OVERLY POLITE
Enter fullscreen mode Exit fullscreen mode

Yes.

You can fail compilation by being too rude or too polite.

The accepted ratio is approximately one polite statement for every three or four statements.

Not enough manners?

Rejected.

Too many manners?

Also rejected.

The compiler apparently believes you're being insincere.

This is not a metaphor.

This is documented INTERCAL behavior.

The C-INTERCAL implementation even preserves the traditional error codes for insufficient and excessive politeness.

And in keeping with the language's philosophy, its manual describes various behaviors with a level of deliberate absurdity that makes ordinary technical documentation seem positively joyless.

One particularly entertaining detail is that an Emacs mode for INTERCAL was designed to help programmers maintain the proper politeness ratio by occasionally inserting PLEASE automatically.

Because of course it was.

The lesson: INTERCAL is the only language in this article where the absurdity is explicitly the point.

The hilarious part is that, after everything we've seen in the preceding seven examples, INTERCAL doesn't seem quite as ridiculous as it probably did in 1972.

Which may be the most damning observation of all.

The Museum of Questionable Decisions

It's tempting to laugh at all of these.

But there's something interesting hiding underneath the absurdity.

Each language reflects the world in which it was created.

VBScript prioritized easy automation.

Go prioritized simplicity and consistency, even when that required unconventional conventions.

COBOL evolved alongside early business computing and control-flow techniques that later generations largely abandoned.

Common Lisp embraced expressive power and an unusually rich standard library.

Paradox and dBASE made databases accessible to generations of business programmers.

MUMPS integrated computation and persistent data storage in a way that still feels distinctive decades later.

And INTERCAL existed to remind everyone that programming languages are human inventions, and therefore perfectly legitimate targets for satire.

The history of programming languages isn't a neat sequence of progressively better ideas.

It's a sprawling collection of experiments.

Some succeeded.

Some failed.

Some were wildly influential.

And some became cautionary tales.

But almost all of them teach us something about the problems programmers were trying to solve, and the assumptions they made along the way.

One Final Observation

After exploring all these languages, I think the most interesting distinction isn't between modern and obsolete languages.

Or compiled and interpreted languages.

Or strongly typed and dynamically typed languages.

It's between languages whose designers believed programmers needed protection from complexity and languages whose designers believed programmers should have the freedom to create as much complexity as they wanted.

And then there's INTERCAL.


Bonus point if you're familiar with the Whitespace language.

Top comments (0)