4 ms·
Oh, man! Imagine the humble pie C would have to eat. C beat out Pascal in the 80s for a lot of reasons, many of them not technical. Pascal had the correct fo
by oblio 4y ago
Oh, man!
Imagine the humble pie C would have to eat.
C beat out Pascal in the 80s for a lot of reasons, many of them not technical.
Pascal had the correct format for strings, the one you mentioned and the one used by all modern languages.
Imagine if after 40 years C would start using Pascal strings :-))
- zabzonk 4y agoexcept that pascal specified that strings of different lengths were actually different types. https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pascal.html https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...
- klodolph 4y agoGotta love the Str255 used everywhere on Macs before OS X came around. That was how Pascal did things on Macs in the 1980s, and it’s not exactly modern—if you want something longer than 255 characters, it’s going to be cumbersome. Been digging through old newsgroups, and it sounds like one of the big reasons C won out over Pascal was because it was easier to find good C compilers in the 1980s compared to good Pascal compilers.
- KerrAvon 4y agoYeah, C compilers were ubiquitous, practically every platform had more than one of them. There were even third-party C compilers for the Mac almost from the beginning. It didn't help that Pascal didn't have a usable standard, which is what led to articles like "Why Pascal is Not Brian Kernighan's favorite language", which also didn't help. Edited to add: there was also some amount of antiestablishment fervor in the microcomputer community, and Pascal was for better or worse perceived as a somewhat ivory-tower language.
- Gibbon1 4y agoPascal on a micro was basically useless unless you were playing with algorithms copied from a book. Because it's a language written by people that only worked on mainframes connected to dumb terminals. Want to write the string 'fat dog' on line 12 column 10? With Pascal you'd have to write a routine in assembly and call it. With C you use a trivial macro. Pascal was also generally very very slow. Almost as slow as basic which had better strings than Pascal.
- klodolph 4y ago“Pascal was slow” is a complaint about the compilers at the time, which is just reiterating my point. Anyway, if you wanted to draw something on the screen, just, MoveTo(10, 12); DrawString('fat dog'); You could do worse.
- pjmlp 4y agoEven 8 bit Pascal compilers for ZX Spectrum were better than that. Anyway, Pascal was designed for teaching, and Modula-2 was designed for production code and systems programming. UCSD Pascal, and Object Pascal also took many of their ideas from Modula-2.
- drfuchs 4y agoStandard Pascal did not store string length and had no notion of variable-length strings. This was such an egregious design failure that various dialects came up with non-standard, non-portable, compiler-specific work-arounds. In the 1980's, it was next to impossible to write a Pascal program that worked cross-platform and did anything with strings. The first ISO standard to address this wasn't until 1990, with yet a new dialect called Extended Pascal, which of course wasn't compatible with the various earlier system-specific dialects, and anyway was way too late for Pascal to "win" over C. See Wikipedia for confirmation: "Brian Kernighan, who popularized the C language, outlined his most notable criticisms of Pascal as early as 1981 in his article "Why Pascal is Not My Favorite Programming Language". The most serious problem Kernighan described was that array sizes and string lengths were part of the type, so it was not possible to write a function that would accept variable-length arrays or even strings as parameters."
- pjmlp 4y agoHence Modula-2 in 1978, which Brian ignored on this famous rant.
- drfuchs 4y agoModula-2 compilers were slow to appear on many important architectures, and again there were various divergent dialects, and the whole shebang seemed to get semi-abandoned when Wirth et. al. shifted yet again to Oberon; lather, rinse, repeat. So none of his post-Pascal languages posed practical competition to C for writing portable, cross-platform code, either.
- pjmlp 4y agoVMS, UNIX, MS-DOS, Amiga, Archimedes, seemed important enough for me. C only became portable by bringing UNIX alongside via POSIX. Then there were all those dialects, K&R C, Small-C, RatC, DBS C,...
- tialaramex 4y ago> Pascal had the correct format for strings, the one you mentioned and the one used by all modern languages. Not really. The most crucial insight is that your string references should be fat pointers, which is not what Pascal does. Look at Rust's &str for the state of the art. Other choices are less important, but having string references be fat pointers is a huge boon. It would probably have seemed profligate in the 1980s, but it was the right choice.
- mananaysiempre 4y ago> Look at Rust's &str for the state of the art. Other choices are less important, but having string references be fat pointers is a huge boon. It would probably have seemed profligate in the 1980s, but it was the right choice. ANS Forth[1], released 1994, used (addr, len) pairs throughout, eliminating most uses of “counted” (Pascal) strings in Forth-83 and earlier. [1] https://forth.sourceforge.net/std/dpans/ https://forth.sourceforge.net/std/dpans/
- Gibbon1 4y agoC with fat pointers and boxing/unboxing would be far more super duper than people realize. The other three are first class types, tagged unions, and closures. Standards committee says no.
- kevin_thibedeau 4y agoThat would be a mess for interop with 8, 16, and 32-bit targets. What size should the length be? What happens when you exceed it? Nowadays you can just 32-bit all the things and ignore most range issues. That luxury didnt exist in the 80s.
- pjmlp 4y agoPascal wasn't alone, almost all C alternatives are better in that regard.