Software heresy: Identifiers with whitespace

A green thought bubble
Identifiers should have whitespace in them.

As best as I can tell, the reason whitespace is forbidden is tradition; no one has considered the possibility since the beginning of time. If a sequence of whitespace were identical to a single space, the problem cases are not too difficult to solve.

In C and C++, the problem case involves declaring a variable. This case is so stereotyped that solving it universally would not be difficult. The problem has a type name followed by the name of a variable. One solution would use the longest matching type name and then use the rest of the text as the identifier name.

class fish { }
fish red fish, *blue fish,
typedef char *red herring[];
red herring for hounds;
red herring &mackerel;

A language that allows whitespace in identifiers would have more descriptive type names and variables names. Camel case and Hungarian-like notations would be unnecessary. Detailed semantic information could be included in identifier names.

Operating systems, loaders, linkers, assemblers etc. that aren’t capable (yet) of handling spaces in identifiers can easily have the symbols with whitespace mangled so that they don’t burp. However, languages such as Scheme and Haskell are difficult to apply this extension.

Heresies like this need to be promptly stamped out.

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s