24

In VB both array access and function calls are done with () which makes it difficult to differentiate between those with a quick look. It also makes more nested levels of parentheses like MyArray(GetIndex()) which is much more readable when written as MyArray[GetIndex()]. I don't know about BASIC but it looks like that the same syntax is also used in BASIC

In fact there's no {} and [] in VB either, and other symbols like @, !, #, ~... are also unused, making the syntax very verbose for no reason

1
45

In the early days, many machines running BASIC had limited character sets. For example, the stock TRS-80 Model I couldn't display the lowercase portion of ASCII, which omitted curly-braces, tilde, and the vertical bar as well. Worse yet, the character codes that usually map to [ \ ] ^ instead mapped to up, down, left, and right arrow characters!

Reaching further back, EBCDIC didn't have a consistent mapping for square brackets, either. There were many different code pages for EBCDIC, each intended for a different region, language, and/or use case. Different code pages could map square brackets to different code points. As a result, a card deck or paper tape from one machine containing those characters might display them as something completely different on another type of machine.

BASIC's syntax, at least in older versions, is well-supported by an uppercase-only display that supports the most common symbols and punctuation.

6
  • The remark about EBCDIC is not entirely true. EBCDIX did have unique assignments for square brackets, as it offered a complete coverage of ASCII without any remapping. By being an 8 bit code it did offer national characters in parallel, unlike ASCI which used redefined several characters, including the brackets - and that is were some missuse is originated. when transferfing data from an ASCII source, the right ASCII to EBCDIC encoding table had to be used - id not, assignments got screwed the very same way as transfering between SACII variants did. – Raffzahn Apr 29 at 19:39
  • 1
    @Raffzahn I've edited my answer in an attempt to clarify this. Does this help? – jeffB Apr 30 at 19:03
  • No, as the assumption is still not really true. The square brackets were, in all cases known to me, mapped to BA/BB (the same way the curly are at C0/D0. This is true across almost all code pages that were used for data processing. Given, there were special code pages for certain usages, like APL, but so were tables that not even had lower case letters or other cases were not all ASCII symbols were present. Using those exotic applications as argument does not fit the reality of common applications. – Raffzahn Apr 30 at 19:26
  • 1
    @Raffzahn I accept that in your experience square brackets were always mapped to BA/BB, but a Google search for EBCDIC square brackets reveals that others have encountered the issue, and that the issue has persisted into the present era. That was the basis for my statement, and I think it's support enough to let the statement stand, even though we of course don't know that this influenced BASIC's syntax. – jeffB May 2 at 0:00
  • 1
    @jeffB Agreed, my experience is mostly tied to the business world. Shoveling data and communicating with remote sub systems :) Now, since you mention EBCDCs influence to BASIC, it might be worth to note that BASIC, to my knowledge, was developed on a GE-200 series, that machine did not use EBCDIC in any way, but it's own 6 bit character set (which in fact did not feature any square brackets). – Raffzahn May 2 at 2:06
27

I don't know about BASIC but it looks like that the same syntax is also used in BASIC

Because Visual BASIC is a BASIC?

Since the very first days of BASIC, arrays are indexed in parentheses and function parameters as well.

When Microsoft added user defined functions to BASIC (*1), they stayed with the existing syntax. A change in either would mean leaving the realm of BASIC - not to mention breaking compatibility with any existing software and any BASIC examples of indexing and/or function calls.

Visual BASIC is a continuation of MS-BASIC 5.x, aka GW-BASIC and QuickBASIC (and QBASIC) and mostly source compatible with them. It was also QuickBASIC that introduced named functions and procedures, as well as made the GOSUB keyword optional.

It's the same natural way any other BASIC developer went when adding named user defined function. From BASIC 09 (1980) and BBC BASIC (1981) all the way to Super BASIC (1984) and GFA BASIC (1986).

In fact there's no {} and [] in VB either, and other symbols like @, !, #, ~... are also unused, making the syntax very verbose for no reason

What you're calling for is a different language. Languages are (mostly) defined by their syntax, as keywords are rather exchangeable. Maybe you're looking for PASCAL? It was quite popular in the early 80s and uses square brackets for array indexing, for exactly that reason (*2).

It's the basic way of BASIC to use parentheses for arrays and function - and symbols like @, !, # and % to qualify variable types.


Some history

Now, going all the way to BASIC's origins, we end with the DTSS running on a GE-200 system. From today's view the GE-200 might be an odd beast, but back in the early days (*3) it's 20 bit words holding 3 6 bit characters weren't unusual. That 6 bit character of course restricted the character set to 64 encodings. In addition, usage of them was highly application specific. For example their COBOL compatible (*4) did support 49 characters including parenthesis, but not square brackets:

enter image description here

On the other hand, their high speed printer did (by default) not provide parenthesis, but square brackets:

enter image description here

(Taken from this scan)

So while it is quite likely that original the usage of parenthesis for index and parameters might have been due the restricted character set of original GE-200 environment, an easy answer can not be given. Though, some information could be gathered by meditating over the original source code.

What is clear is that it was not due some (more or less) standard character set. Especially not ASCII or EBCDIC, as neither of them was already developed and/or available at the time BASIC was defined.


*1 - That is beyond the rudimentary support of FN() of earlier MS BASIC dialects.

*2 - Inherited from ALGOL - the very same way C did :))

*3 - I.e. pre /360 designs.

*4 - Yes, COBOL compatible as at the time, there was still haggling about what features are to be included and ho they are to be handled in source. Mainly about I/O handling, including character set (and Hollerith conversion) .

6
  • Comments are not for extended discussion; this conversation has been moved to chat. – Chenmunka Apr 30 at 17:54
  • 3
    "Languages are (mostly) defined by their syntax" -- I disagree. Can you transform C to C++, or LISP, or BASIC, or FORTH, by transforming the syntax? Although the syntax is the most visible part of a language, it is the language's semantics that define it. A language specification will often describe the syntax in (for example) a few pages of EBNF, but spend hundreds of pages on the semantics. – Wayne Conrad Apr 30 at 20:04
  • 1
    @WayneConrad Well, beside that semantics without a syntax aren't a language, one can also not do any transformation without. It is the syntax that differentiates languages from each other. ADD A TO B GIVING C adds two numbers in COBOL, while C := A + B does the same in PASCAL and LET C = A + B in BASIC. All three are semantically the same. But they do differ in syntax - and that's exactly why semantics can not tell languages them apart, but syntax does. – Raffzahn May 2 at 2:44
  • Seems odd that the GECOM character set had separate encodings for hyphen and minus, when ASCII merged them. – dan04 May 24 at 21:58
  • @dan04 different emphasis. Then again, this seems more of a mislabeling, as that character is almost universal used as underscore - as a character and literal, as it was used with double striking to underline a print line. quite useful in tabulating. – Raffzahn May 24 at 22:24
16

The Minimal Basic Standard, ECMA-55, 1st Edition, January 1978, contains a very limited character set, only upper case, and very few non-alpha-numeric characters (including parenthesis, but no other brackets); certainly not the full ASCII character set.

This is likely due to compromises in the standards committee between corporate implementers of various existing BASIC versions, many of which were earlier designed for input on keyboards that did not support a full ASCII character set (Apple I, et.al.).

For Tiny BASIC implementations, this also reduces the size of the token recognizer.

3
  • Apple I hardly matters as so few of them were ever made, but the much more common Apple II also did not include []'s on its keyboard, especially ironic as the name in its logo was written as "Apple ][". Apple IIe did finally include them. – Darrel Hoffman Apr 30 at 16:29
  • The Apple II was introduced circa mid-77, likely after the ISO committee work for the Minimal Basic Standard was started. – hotpaw2 Apr 30 at 16:57
  • Neither of them - or any other micro manufacturer - really mattered for the ECMA standard. The drivers were mini computer manufacturers like HP, Wang, Nixdorf or Olivetti. – Raffzahn Apr 30 at 20:28
10

A number of BASICs from the minicomputer era used []'s for array access. The most notable was HP Timeshare BASIC, which I assume inspired the other versions that used the same syntax. In HP, it was optional, and () and [] were synonymous. By convention, () was used for array access while [] was used for array and string slicing. This was by no means universally used, as one can see in books like What To Do After Hitting Return.

9

BASIC was originally developed on DTSS, which used Model 33 Teletypes for user I/O. The Model 33 didn't have [] characters, so BASIC couldn't use them.

15
  • Indeed. See here: bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf, pages 14 and 15. – Joe Stevens May 1 at 11:31
  • I think this answer is wrong. Model 33s did have []. I can attest to that, having written Algol 60 code on them. Furthermore DTSS supported Algol 60 and the DTSS documentation uses the correct brackets, noting they are shift-K and shift-M. (Teletypes could be purchased with different typeheads). – another-dave May 1 at 12:31
  • Originally at least, per this document, they were using model 35 ttys, but that does not change the argument. – another-dave May 1 at 12:38
  • 1
    @another-dave I believe that 33's and 35's with brackets were exotica. See the image at en.wikipedia.org/wiki/Teletype_Model_33#/media/…. No []. – John Doty May 1 at 22:07
  • 3
    @another-dave I helped port DTSS Algol to Multics in 1972. I also used it. I don't think it required [] in those days. The reason is that the most common Multics terminal was an IBM 2741 with a PTTC/EBCD typeball, and that had no []. I think I would remember this as a serious issue if DTSS Algol required []. Perhaps an early implementation used [], but that proved difficult because most terminals and printers didn't have those characters. – John Doty May 1 at 22:16
2

What a bunch of whippersnappers!

EBCDIC was part of the IBM S/360 announcement April 7, 1964. Basic first ran May 1, 1964. No connection.

While DTSS was a time sharing system, the GE-225 also ran batch programs. My second or third assembly language was VFAP (Valley Forge Assembly Program) on a 225 at the San Fernando Valley State College. And we submitted jobs on cards.

The card punch most frequently used at the time of Basic's inception was the IBM 026. This was developed in the late 1940s. It was originally designed for use with the IBM 407 accounting machine. So the character set on the original 026 did not even include parentheses. (Parenthetically, if you will pardon the phrase, a later 026 version was developed which included parentheses for that newfangled Fortran programming language.)

026 CE manual: http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/punchedCard/Keypunch/024-026/22-8319-0_24_26_Customer_Engineering_Preliminary_Manual_of_Instruction_1950.pdf

Doug Jones lists a GE card code with both parentheses and square brackets. See: https://homepage.divms.uiowa.edu/~jones/cards/codes.html

I really think that those were developed for the later time sharing machines (e.g. 415, 635). But I never used these in a time sharing environment.

I received an introduction to the differences between 026 BCD and 029 EBCDIC when my first COBOL program, punched on an 026, generated a raft of errors due to the 360-50 expecting 029 EBCDIC. And 029-punched programs never printed correctly on a 407 which many of us sued for proofreading.

So, to answer the original question - Basic did not use square brackets or curly braces because at least some of the hardware they used for input did not have square brackets or curly braces.

In contrast, the DecWriter terminals used at Bell Labs when Unix and C were developed included those characters. So the C language reflected their input devices in much the same way.

Have to cut this off. The museum keepers are coming around to dust the dinosaur bones and I have to pretend to be fossilized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.