Ever wonder why they are called strings?

The Douglas Crockford lectures on Javascript are quite popular and very informative for somebody willing to dive head first into Javascript. A playlist of all his lectures can be found here.

In one of his lectures where he is discussing the basic JavaScript data types, he asks this interesting question "Ever wonder why they are called strings?". As soon as I heard, my first thought was how come I never asked that. Ever since I started programming, I had taken term narturally to mean a sequence of characters and never questioned why they were called strings. Probably one of the reasons is that english is not my first language, and when I first started programming which was in QBASIC, I just accepted them to be called as strings in english.

But when Crockford asked this question, it had me wondering why really were they called strings. Its not that in english, a sequence of characters was known as strings before the term came to be used in any programming language. Crockford goes on to wonder that probably nobody knows.

as far as I can tell, the first use of string to mean a data type in a programming language which is a sequence of characters was the ALGOL 60 report [...] But they didn't explain in the report why they called it string, and there doesn't appear to be a good reason for it. It probably should have been called text, or possibly Hollerith after Herman Hollerith in sort of the same way we named Booleans after Boole.

After watching the video, I turned to the Internet to provide an answer to a question which seemed so basic and yet nobody knew an answer to. My initial search brought me to this stackoverflow question which basically points to this email thread from 1992 which says

The 1971 OED (p. 3097) quotes an 1891 Century Dictionary on a source in the Milwaukee Sentinel of 11 Jan. 1898 (section 3, p. 1) to the effect that this is a compositor's term. Printers would paste up the text that they had generated in a long strip of characters. (Presumably, they were paid by the foot, not by the word!) The quote says that it was not unusual for compositors to create more than 1500 (characters?) per hour.

Hmm. Kind of makes sense that printers came up with this term because their long strips of characters looked like strings. But nowhere does it explain the relationship between printers using it late 1800s and programmers finding it suitable for a sequence of characters almost 70 years later.

I digged further and landed on programmers stackexchange. Feels kind of right place to find the answer to this question. The accepted answer is quite thorough in its research and I think we can safely say, that this is the most plausible reasoning behind the history of the term 'string' in programming.

I would argue that "string" in its computer science jargon sense as an ordered list of characters became common over a couple of years around 1960. Before that, authors like Yngwe and McCarthy could say "string of characters" and be sure that they were understood, but could not use "string" as a bare word in the sense it's used today.

String as a word for sequence of characters was used in a 1958 paper by Yngve. But it was still far from being used as a representation for a data type. It was only in 1960 that ALGOL60 used the term for a data type which was further propagated by languages like COMIT and SNOBOL (The name itself explains it StriNg Oriented and symBOlic Language)

comments powered by Disqus