Blob/Cat

2020/01/24 2:50:38 PM UTC

@sir Have you seen the original Bourne Shell source? If so, would you say something along the lines of "this is the only project where the GNU clone's source is less terrible than the UNIX source"?

2020/01/24 2:51:14 PM UTC

@kick I have not seen the original bourne shell source, no. I have read a decent subset of dash, and a little bit of bash, and I reckon both suck

2020/01/24 2:53:47 PM UTC

@kick yeah, this is pretty awful. I don't think that it's fair to point at UNIX as an example of bad code, though. Consider that this codebase started in assembly, designed C for the purpose of rewriting it in, rewrote it in _pre_ ANSI C, then rewrote some of it in ANSI C, then was promptly abandoned. I can clearly see the lineage from all of these steps in its history in this source file.

2020/01/24 2:54:54 PM UTC

@kick can also totally see the influence of FORTRAN people who were forced to work on UNIX and bastardized C (an as of yet unproven language) to fit their square shaped peg into it

2020/01/24 2:55:30 PM UTC

@sir ALGOL, actually. It's not FORTRAN, but you got close!

2020/01/24 2:56:02 PM UTC

@kick ah, well, FORTRAN has ALGOL in its lineage. I wasn't alive for any of this, cut me some slack 😉

2020/01/24 3:00:52 PM UTC

@sir Bourne Shell was first in v7 UNIX, and was never written in any dialect of assembly. There is no other tool in the v7 source tree that’s as quite as demented as this, though a few come close. Bourne was just a psychopath. My favorite thing ever is that the original IOCCC announcement on Usenet was directly caused by someone having to fix a bug in Bourne’s awful “C”!

*Q: How did the IOCCC get started? A: One day (23 March 1984 to be exact), back Larry Bassel and I (Landon Curt Noll) were working for National Semiconductor’s Genix porting group, we were both in our offices trying to fix some very broken code. Larry had been trying to fix a bug in the classic Bourne shell (C code #defined to death to sort of look like Algol) and I had been working on the finger program from early BSD (a bug ridden finger implementation to be sure). We happened to both wander (at the same time) out to the hallway in Building 7C to clear our heads.

We began to compare notes: ‘’You won’t believe the code I am trying to fix’’. And: ‘’Well you cannot imagine the brain damage level of the code I’m trying to fix’’. As well as: ‘’It’s more than bad code, the author really had to try to make it this bad!’’.*

https://groups.google.com/forum/?hl=en#!msg/net.lang.c/lx-TAuEyeRI/HdOOnNx6LC0J

replies
0
announces
6
likes
5

2020/01/24 3:07:50 PM UTC

@sir Funnily, though, most of the most devout C advocates from back then are using a clone of ALGOL now (Go is pretty much a 1:1 modernization of ALGOL-68), so maybe Bourne got the last laugh.

2020/01/24 11:37:50 PM UTC

@kick @sir More like convergent evolution, considering that it actually comes from the ALGOL-W lineage, by way of Pascal, Modula-2, and Oberon (along with ALGOL-68 still having a number of features Go doesn't, as David Given infamously noted in his article criticizing the language)