6 ms·
If you judge the coding style of the early 1970s with modern standards, it isn't going to look great. 50 years is a loooong time. dmr was one of, if not the fi
by code_sloth 6y ago
If you judge the coding style of the early 1970s with modern standards, it isn't going to look great. 50 years is a loooong time.
dmr was one of, if not the first C programmer(s).
- kiwidrew 6y agoAnd he was almost certainly using ed(1) as his editor and a mechanical teletype at 7.5 or 10.0 characters per second as his terminal... The C language (and all of Unix) was designed to be very terse as a consequence.
- tralarpa 6y agoWas it different for the designers of ALGOL/SIMULA/Pascal?
- kiwidrew 6y agoYeah, those languages were IIRC designed to be edited offline (as a deck of punch cards) and submitted to a mainframe via high-speed card reader as a batch job.
- tralarpa 6y agoVery interesting when you think about it. A language created in 2009 (Go) owes its syntax to a language from 1969 (B), and the latter looks like it does because it was designed during a short transition period between offline editing (1960s) and electronic terminals (1970s). And there are people claiming that computer scientists are not conservative :) To what extend this explanation is correct is another question... The article by Denis Richie says "Other fiddles in the transition from BCPL to B were introduced as a matter of taste, and some remain controversial, for example the decision to use the single character = for assignment instead of :=". It's a kind of butterfly effect :) Mr. Richie prefered "=" over ":=" and fifty years later a server crashes somewhere because somebody wrote a=b=c instead of a=b==c.
- ktpsns 6y agoActually the transition from "offline editing" and "electronic terminals" was not short at all. Teletypes (aka "typewriters which can recieve content encoded in electricity, next to the user keyboard") date back way beyond computers, and were still in use in the 1980s (but evventually superseded by fax). Teletypes were cheaper, faster and more convenient then video terminals. Don't underestimate of having a printout of your session, especially when being online (i.e. connected to the mainframe or mini computer) is something valuable and your terminal is "dumb" and has no storage (except paper).
- pjmlp 6y agoB was a descendant of Bootstrap CPL, a language never intended to be used for anything other than making a CPL compiler, really a butterfly effect.
- oblio 6y agoThat period lasted what, 10 years after Unix was created? And we'll be stuck with those decisions decades if not centuries. Similar story with the design of QDOS / MS-DOS / Windows and nowadays with Android. Both designed for super underpowered machines that basically went away less than a decade after they were launched and that will be hobbled because of those early decisions for a long, long time.
- compiler-guy 6y agoWe will be hobbled with these decisions for a long time precisely because the complete package of trade offs the designers made were so successful. If they had gone for wart-free on properly powered hardware, they would be stuck back in Multics land or living with the gnu Hurd—cancelled for being over budget or moving so slowly that projects that actually accomplish what the users need overtake them. Do I wish that C had fixed its operator precedence problem? Sure. But the trade offs as a total package make a lot of sense.
- colejohnson66 6y agoIs there an explanation on why C’s operator precedence is weird? Such as: why does the bitwise AND have higher precedence than logical AND?
- briantakita 6y ago> why does the bitwise AND have higher precedence than logical AND? Why is this precedence weird? Bitwise AND tends to be used to transform data while a logical AND tends to be used for control flow.
- colejohnson66 6y agoI meant equals having a higher precedence than bitwise AND. As in: if (x & 2 == 2) ...is actually parsed as: if (x & (2 == 2)) ...which isn’t intuitive.
- 6y ago
- Koshkin 6y agoI try ed(1) once in a while and I find it pretty usable (and even rather efficient if you know what you are doing). cat(1) also works if you just want to type a new text. Speaking of terseness, I love the the fact that C does not have 'fn'.
- rootbear 6y agoWe used to speak of a great Unix systems programmer as someone who could write device drivers with cat and have them compile and run the first time.
- siltpotato 6y agoBefore I look up `man cat`, what can you do with `cat` other than just see what's in a file?
- Crespyl 6y agoWhen not given a file, cat will just read from stdin, so you can use "cat > file.c", write some text, and send EOF with ^D when you're done. Obviously, there's no way to go back and edit anything mid-stream, you have to write the whole thing out in one shot.
- amyjess 6y agoYou can join files together. $ cat foo bar > baz will join the files foo and bar together into a single file called baz