BASIC

From Maze

(Difference between revisions)
Jump to: navigation, search
(More on Kemeny)
(→Line Numbers in BASIC (sidebar))
Line 138:Line 138:
Ultimately, BASIC became what it was in 1982 thanks to the institution of higher education where it was first developed, the corporation that implemented it and licensed it for use on home computers (including the Commodore 64), and, significantly, the hacker ethic of code sharing that allowed BASIC programs to circulate freely.
Ultimately, BASIC became what it was in 1982 thanks to the institution of higher education where it was first developed, the corporation that implemented it and licensed it for use on home computers (including the Commodore 64), and, significantly, the hacker ethic of code sharing that allowed BASIC programs to circulate freely.
−
== Line Numbers in BASIC (sidebar) ==
+
== Line Numbers and Colons: BASIC's Responses to Changing Hardware(sidebar) ==
−
Microsoft has used its position as a corporate supporter of BASIC to make many changes to the language since the days of the Altair, adding and removing pieces that became necessary or obsolete as hardware progressed. One of the features that is most associated with BASIC, the line number, falls into this category.
+
Microsoft has used its position as a corporate supporter of BASIC to make many changes to the language beginning with the days of the Altair, adding and removing pieces that became necessary or obsolete as hardware progressed. For example, to allow programs to be written more compactly--an important feature given the Altair's interface, which could literally be painful to program--Microsoft's Altair BASIC introduced the colon (:) as a separator of statements on the same line. This allowed lines such as:
−
Unlike its punch card-derived predecessors, BASIC didn't require programmers to put things in certain columns; but there was a requirement that a number, such as "10", appear at the beginning of each line. While this facilitated branching by allowing the GOTO and GOSUB statements refer to line numbers where program flow should jump to, BASIC did not actually need line numbers for this purpose. Labels, such as those used in pre-existing languages like assembly, would have sufficed. The line number's real value is seen on a Teletype or other print terminal, or in any environment where full-screen, nonlinear editing is not an option. Line numbers made it easy in those cases to delete existing lines; simply type the line number without any further instructions, and the line disappears. To correct a single existing line, just retype a line with the same line number. To see what code is currently on a particular line, "LIST 50" will do the trick -- although if one had written the line recently, one could also look up or literally "scroll" back to where the line had been printed out.
+
<code>160 R=16:PRINT"HOW MANY DECKS (1-4)";</code>
 +
 +
This feature was missing from minicomputer BASICs and the ANSI standard, and Kemeny and Kurtz saw it as potentially confusing rather than helpful. When they released their much-revised True BASIC for home computers in 1983, it did not allow multi-statement lines. The colon is, however, important to 10 PRINT; this program could not be written as a concise one-liner without it.
 +
 +
Another prominent feature that appears in 10 PRINT is also an artifact of the hardware lying beneath the language. Unlike its punch card-derived predecessors, BASIC didn't require programmers to put things in certain columns; but there was a requirement that a number, such as "10", appear at the beginning of each line. While this facilitated branching by allowing the GOTO and GOSUB statements refer to line numbers where program flow should jump to, BASIC did not actually need line numbers for this purpose. Labels, such as those used in pre-existing languages like assembly, would have sufficed. The line number's real value is seen on a Teletype or other print terminal, or in any environment where full-screen, nonlinear editing is not an option. Line numbers made it easy in those cases to delete existing lines; simply type the line number without any further instructions, and the line disappears. To correct a single existing line, just retype a line with the same line number. To see what code is currently on a particular line, "LIST 50" will do the trick -- although if one had written the line recently, one could also look up or literally "scroll" back to where the line had been printed out.
The practice of numbering program statements by multiples of five or ten is not merely aesthetic; the insertion of new lines in a program requires that, as the 1964 manual puts it, "the original line numbers <ins>not</ins> be consecutive numbers" (22). Numbering a program 10, 20, 30, and so on ensured that between every existing program statement there was room for nine more. It was an acknowledgement that a program is dynamic rather than fixed and perfect. The ''Commodore 64 User's Guide'' also advises that "it is good programming practice to number lines in increments of 10--in case you need to insert some statements later on" (33).
The practice of numbering program statements by multiples of five or ten is not merely aesthetic; the insertion of new lines in a program requires that, as the 1964 manual puts it, "the original line numbers <ins>not</ins> be consecutive numbers" (22). Numbering a program 10, 20, 30, and so on ensured that between every existing program statement there was room for nine more. It was an acknowledgement that a program is dynamic rather than fixed and perfect. The ''Commodore 64 User's Guide'' also advises that "it is good programming practice to number lines in increments of 10--in case you need to insert some statements later on" (33).
Line 149:Line 153:
In 1991 Microsoft realized that the perception of BASIC as limited to simple programs was holding the language back, and that this perception waslargely due to a feature of the language that was no longer even necessary. Nonlinear text editors had long been available, and line numbers were now doing more damage than good. As part of their 1991 QBasic the company deprecated line numbers, replacing them with the assembly-like text labels that had originally been dismissed as inconvenient on the hardware of the era.
In 1991 Microsoft realized that the perception of BASIC as limited to simple programs was holding the language back, and that this perception waslargely due to a feature of the language that was no longer even necessary. Nonlinear text editors had long been available, and line numbers were now doing more damage than good. As part of their 1991 QBasic the company deprecated line numbers, replacing them with the assembly-like text labels that had originally been dismissed as inconvenient on the hardware of the era.
 +
 +
The simple fact that 10 PRINT includes both the colon and the line number--features that have been added and removed from BASIC in response to hardware changes--locks 10 PRINT into not just a specific set of years, but a specific era of computing caught between competing input mechanisms. Its heritage and provenance is literally written right into its code.
== Commodore BASIC==
== Commodore BASIC==

Revision as of 22:14, 11 July 2011

View this revision of BASIC.

Personal tools