views:

241

answers:

4

In similar manner to the similar question about generics. What was its first appearance, and how did spread to C?

edit: corrected question based on Jon Skeet's answer (; is a terminator, not a separator)

+2  A: 

It's not a separator in C - it's a terminator.

However, I believe ALGOL may have been the first to use the semicolon in this sort of way.

Jon Skeet
separator as in "statements separator" ?
chakrit
thanks, I corrected the question
bandi
Careful. I think in Algol the ; have been a separator (as it is in Pascal). Not a terminator (as it is in C and Ada).
S.Lott
As a totally unrelated aside, OCaml's ";" is really an operator, not a terminator. It has the type unit -> 'a -> 'a, where the operator accepts two inputs and returns the second. There's a little blurb on this page (http://www.ocaml-tutorial.org/the_structure_of_ocaml_programs) which describes the ";" operator in detail.
Juliet
http://www.csci.csusb.edu/dick/samples/algol60.syntax.html#separator
S.Lott
@S.Lott: Made the answer more ambiguous :)
Jon Skeet
its called a terminator in C, but it acts like a separator
RBarryYoung
@RBarryYoung: No, it's a statement terminator in C. The way to tell is to look at the last statement in a block: does it need a ; or not? If so, it's a terminator, otherwise it's a separator. Terminators are generally easier on the programmer than separators.
David Thornley
No, the way to tell a terminator is: s it required to terminate every statment, as it was in COBOL an Jovial? It does not work that way in C. The most that can be sais in C is that ";" is more or a terminator there, than it was in Algol, Simula or Pascal. But it's still not a true terminator.
RBarryYoung
And actually, most from that time and up through the mid to late 80's felt that C's inconsistent terminator/separator aproach was hardest of all on programmers. (after that everyone coming out of college had been "baby ducklinged" on C and nolonger seemed capable of objective thought on the matter). C's approach to semicolons and statement termination is really onlu an advantage for the parser/complier writers and is in fact merely a burden for the programmer. Especially since it is entirely possbile to have languages with NO statement terminators needed.
RBarryYoung
**@R Barry Young:** 'k, the history lesson is great, but would have been a lot more relevant if you'd taken time to explain why you consider it to act as a separator first.
Shog9
A: 

Pascal had semicolons as terminators before C did; not sure if it was the first language to have them, though.

fbrereto
pascal as them as separators - terminators are similar but they are different.
plinth
+1  A: 

Definitely ALGOL.


Hmm, somebody changed the question. That's not quite cricket.


As for how it spread, well semicolons spread Algol 60 -> Simula -> C. K+R said that Pascal didnt influence them, IIRC, though some disputed this clam.


Statement terminators (other than new-line) spread from COBOL -> Jovial -> C. Though each had a different character as the teminator.

RBarryYoung
FORTRAN used column 72 of a punch card as a terminator, unless there was a continuation character in column 6 of the next card. (Don't ask how I know.) Lisp, the other survivor of the really early languages, just had statements delimited by parentheses.
David Thornley
No, you mean that F77 used a *continuation* character in column72. There was no termination character in F77 (unless you count new-lines which they didnt then).
RBarryYoung
I dimly remember the amazing new concept that the thing between lines of code could be considered a character, even though, in ASCII, that's exactly what it was.
Mike Dunlavey
A: 

ALGOL is my guess too.

The significance is that it freed the user from punch-card-style fixed format.

If you have to use Fortran 77, you know what that means.

Mike Dunlavey
Though that was something of an irrelevant freedom in 1960.
RBarryYoung
And, IIRC, it was valid in FORTRAN-77 to use it in non-Zoned format.
RBarryYoung
@RBarry: don't you still have the line-length restriction and continuation characters? We hit that all the time.
Mike Dunlavey
... not to mention only 1 statement on a line.
Mike Dunlavey
Mike Dunlavey: 1 statement per line, yes. The rest, I am not sure, it's hard to sort out all of the different versions and the propietary enhancements from the standard features. (it *was* 25-35 years ago :- ).
RBarryYoung
IMHO, the more likely reason that Algol pioneered the non-line-break style of statement separation/termination ha to do with it's most common storage, presentation and execution medium: Academic Journals. Being able to reformat the line-breaks would have been a real boon for the type-setters. (COBOL and FORTRAN's default medium on the other-hand was punched-cards, which explains why they would favor not only line-break sensitivity, but vel "zone" (column number) sensitivity.
RBarryYoung
@RBarry: That's an interesting insight. I also wonder if it had to do with the use of paper tape by DEC. I can't remember what the Burroughs machines used for media, but I don't think it was punch cards.
Mike Dunlavey
... I also just wiki'd Burroughs, then ALGOL-58, then Backus-Naur-Form, then Compound (begin-end) Statements. I didn't find a specific reference to semicolons, but it had to be in there.
Mike Dunlavey
I actually worked for DEC for 10 years, but they were late to most of this (DEC was a player c.73 to 90, most of this, except F77 was done prior to 72). DEC's paper-tape as descendend from the teletype ASR/KSR-33 paper-tape readers (attached to the teletypes, IIRC). But paper-tape was never a primary medium for any langage, it was always a backup, archival or distribution medium, not the preferred one for developers or execution. I geuss it was really an early substitute for MagTape in many ways.
RBarryYoung
I don't think that Algol-58 had semicolons. Before my time actually, but everything I've read implies it was introduced in Algol-60.
RBarryYoung
Mike Dunlavey