Development of ASCII started earlier than what you think (see for instance Eric Fischer's The Evolution of Character Codes, 1874-1968) and IBM 360 - for which EBCDIC was developed -- should have used ASCII if its development had not been so slow (see http://www.bobbemer.com/P-BIT.HTM)
See also C. E. Mackenzie, Coded Character Sets, History and Development, ser. The systems programming series. Addison-Wesley, 1980. which describes the development of ASCII, EBCDIC and some other character sets with rationale for some of the assignations (things about chain printers and punched cards are fascinatingly obsolete but still have influence on what we use).
While the other answers note that argv
comes from C, where did C get the idea to call an array a "vector"?
Directly, it came from BCPL. Though argv
refers to the vector of (string) arguments, BCPL did have strings stored in vectors, but they were string literals and they worked like Pascal strings. The vector had two elements: the length at literal!0
and the characters at literal!1
. According to Clive Feather, strings were manipulated by "unpacking" them into character arrays, transforming the array then "repacking" them into strings: compare this with C where strings are character arrays.
So yes, C used v for vector because something else had done so before. Now, did anything before BCPL use vector in this way? BCPL was itself a simplification of the "Cambridge[or Combined] Programming Language": this used vector
as a synonym for a 1-dimensional array and matrix
as a synonym for a 2-dimensional array. This is consistent with the notation in mathematics of vectors and matrices, though in CPL they're just handy mnemonics and don't have any of the properties associated with the mathematical structures.
Can we push back further in time regarding computing languages? One potential branch of our trail runs cold. CPL was heavily influenced by Algol 60 (the 1963 update). Now ALGOL 68 had types that were described as "packed vectors", such as bits
and bytes
: but these weren't in earlier releases of Algol which just had ARRAY
referring to array. As BCPL comes from 1966, CPL must have been before that (but after 1963): ALGOL 68 (standardised in 1968 and 1973) cannot have been a direct influence.
On the other hand, Main Features of CPL also makes reference to McCarthy's LISP system. While this doesn't use vector to refer to a data structure in the system itself, those being S-expressions, M-expressions and L-expressions (L-expressions are strings, so any association between vector and string has disappeared), it does use vector in another sense to represent the "values of a number of variables" representing "the state of the machine at any time". So we have evidence for an assumption made in the comments: that use of the word 'vector' to mean 'array' in computing comes from application of the similar term in mathematics.
Best Answer
BASIC needs to be taken into context with its contemporary languages: early fortran, cobol and assembly.
Back when I was dabbling on 6502 assembly without labels, this meant that when you found that you needed to add an instruction somewhere in the middle of tightly packed code (I later added NOPs) you needed to go through and redo all of the jump addresses. This was time consuming.
Fortran was a line numbered based system that predated BASIC. In Fortran, columns 1-5 were a line number to be used for targets for branching. The key thing with Fortran was that the compilers tended to be a bit more intelligent than the BASIC interpreter and adding a few instructions was just a matter of punching some cards and putting them in the deck at the right place.
BASIC, on the other hand had to keep all of its instructions ordered. There wasn't much of a concept of a 'continuation of the previous line'. Instead, in Applesoft BASIC (one of the widely used dialects that I am familiar with and can find information on) each line in memory was represented as:
It had two bytes for the address of the next line (
NN NN
). Two bytes for the line number of this line (TT TT
), and then a list of tokens (AA BB CC DD .. ..
) followed by the end of line marker (00
). (This is from page 84-88 of Inside the Apple //e)An important point to realize when looking at that memory representation is that the lines can be stored in memory out of order. The structure of memory was that of a linked list with a 'next line' pointer in the structure. This made it easy to add new lines between two lines - but you had to number each line for it to work properly.
Many times when working with BASIC, you were actually working in BASIC itself. In particular, a given string was either a line number and BASIC instructions, or a command to the basic interpreter to
RUN
orLIST
. This made it easy to distinguish the code from the commands - all code starts with numbers.These two pieces of information identifies why numbers were used - you can get a lot of information in 16 bits. String based labels would take much more space and are harder to order. Numbers are easy to work with, understandable, and easier to represent.
Later BASIC dialects where you weren't in the interpreter all the time were able to do away with the every line numbered and instead only needed to number the lines that were branch targets. In effect, labels.