9

I've noticed that in computer programming, underscores are used extensively to create names that are technically one word long but consist of several different words. For example, C++ has priority_queue or get_temporary_buffer. However, this use case only exists because it's easier for software to split apart source code using whitespace as boundaries. In fact, in every case I can think of where I've seen underscores used, the rationale has always been to simplify some automated process.

Did the underscore character exist before computers were invented? If so, what were they used for?

6
  • 2
    Technically speaking, it would be easier for the computer to parse variable names with whitespace in them than it would be for the programmer and maintainers due to a programming language's strict syntax rules. In other words, there would be a clearly defined behavior for the computer but it would confuse the hell out of us humans because we think we already know what whitespace means.
    – MrHen
    Commented Mar 25, 2011 at 16:05
  • 2
    To add to @MrHen's accurate observation, a computer can parse on one character just as easily as it can on any other character. Most computer languages are designed to parse on blank spaces because humans are accustomed to parsing on blank spaces.
    – oosterwal
    Commented Mar 25, 2011 at 16:33
  • 1
    Why is the etymology - so to speak - of English punctuation off topic? I don't understand. Commented May 30, 2015 at 11:55
  • Originally Answered: How italics were indicated for printing in manuscripts before computers have appeared? In the US and Europe, with a single straight underline. (A wavy underline indicates bold; two straight lines indicated small caps and three straight lines indicated full caps. Three straight lines was not ambiguous because in traditional printing, italic small caps was not allowed.) quora.com/…
    – Phil Sweet
    Commented Jun 6 at 14:42
  • The Selectric typewriters had underscore and "typamatic" keys to align underscores efficiently from the keyboard without having to jockey the carriage. publications.lexmark.com/publications/pdfs/2007/typewriters/…
    – Phil Sweet
    Commented Jun 6 at 14:54

2 Answers 2

19

Yes. The underscore appeared first on mechanical typewriters, and was used as a combining glyph to underline text. You would type your text, then move the carriage back the beginning of the word, and type a series of underscores. It was also used to create horizontal “fill in the blank” lines, such as:

   Name: ________________
Surname: ________________

You can read more on the Wikipedia article.

6
  • 2
    It was also handy for making check boxes with an underscore on two lines for the top and bottom and exclamation marks ! for the sides. Not all typewriters had a vertical bar |.
    – oosterwal
    Commented Mar 25, 2011 at 16:35
  • 4
    LOL, unbelievable that I learned how to type on a typewriter and used underscores exactly in this manner yet both seem to be historical curiosities to kids these days. Didn't realize I was THAT old. Commented Jan 29, 2014 at 22:09
  • (1) It should be observed that the primary purpose of the underscore character (underscoring, i.e. underlining) follows from the very meaning of underscore. (2) This use of the character was not limited to mechanical typewriters; it was also used this way on electric typewriters and even in some early word-processing. (3) It may also be useful to add that, as pointed out above by Phil Sweet, underlining in a typescripts was at the time, by convention, the equivalent of italicising in typeset texts.
    – jsw29
    Commented Jun 6 at 16:21
  • 1
    The underscore appeared long before the typewriter.
    – TimR
    Commented Jun 6 at 19:02
  • @jsw29 you seem to be confusing cause and effect. The function of the underscore character is the reason for its name, not a consequence of it.
    – phoog
    Commented Jun 7 at 0:57
-2

Underlining was used in medieval insular manuscripts. A single character could be underlined, just as on a typewriter.

In the days of the manual typewriter and earlier, what you have called the "underscore" wasn't a "character" (it was not part of an alphabet, and not part of an abstract system like Unicode) but it was a glyph that could be put to use for particular purposes in texts.

5
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – Chenmunka
    Commented Jun 6 at 17:58
  • 1
    How doesn't it answer the question? The underscore was used before typewriters even. It might not be the answer that came into your head, but the _ glyph did exist and it had particular purposes.
    – TimR
    Commented Jun 6 at 18:51
  • It is of course true that handwritten underlining has been around for a long time, but when people underline something by hand they think of the whole line as one item rather that a series of distinct ones (e.g. when they underline a five-letter word they don't think of the line as consisting of five of anything). That is something very different from the underscore character on a keyboard, which is what the question is about.
    – jsw29
    Commented Jun 6 at 20:17
  • @Jsw29 That's not quite correct. Individual letters can be underscored in manuscripts. The origins of the underscore on the computer can be traced back, through the typewriter, to handwriting. It was not a "new character" on the typewriter, simply a key that corresponded to the mark a pen could make. And the underscore mark on the typewriter was extra wide to simulate underlining when multiple marks were placed side-by-side on the page. It is only with the advent of computer programming, I believe, that the underscore found another use, to separate the pieces of multi-word variable names.
    – TimR
    Commented Jun 7 at 9:22
  • I know of no evidence that would place the underscore as delimiter or word-separator (a form of "punctuation" if we use that word quite loosely) before the advent of programming languages.
    – TimR
    Commented Jun 7 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .