Invisible programming

The esoteric programming language Whitespace uses only three characters: tabs, spaces, and line breaks. That makes it effectively invisible to the naked eye.

Tab key
Marcin Wichary from San Francisco, Calif. / CC BY

More than a year ago I wrote about Shakespeare, the programming language made entirely of text that looks like Shakespearean plays. Shakespeare is just one of several so-called esoteric programming languages. They’re a kind of performance art, a way to push the boundaries of programming and entertain or baffle us.

Whitespace is one such language. In programming languages like JavaScript the “whitespace” characters are pretty much irrelevant – when the computer reads the language the spaces and tabs don’t make a difference in how that programme is executed. (Well, except in matters of style. Programmers have been debating whether to use spaces or tabs to indent lines since… well, for decades, really. See “Spaces vs. Tabs” in the links below if you want to go down that particular rabbit-hole.) Whitespace takes the opposite tack.

Yep, in Whitespace every character is ignored except for the blank ones: the spaces, the tabs, and the linefeeds (the line breaks). If you think that’s not enough to make a programming language, remember that binary code gets by with just 0s and 1s. Here’s a sample of Whitespace, the first line of the instructions to print “Hello, World!”:

 

Haha, sorry, I couldn’t resist. Here’s a non-invisible version:

[space][space][space][tab][space][space][tab][space][space][space][line return]

The coolest thing about this programming language is that it could conceivably be slotted into the gaps of another language’s code – that other language using the text and Whitespace using the spaces.

One Reply to “Invisible programming”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s