News for hackers. Stuff that matters.
Re:Dennis Ritchie’s first C compiler (c. 1972) by kiwidrew on Thursday March 11, 2021 @03:52AM (#26421799)
And 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by Koshkin on Thursday March 11, 2021 @09:30AM (#26424346)
I 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'.

Re:Dennis Ritchie’s first C compiler (c. 1972) by rootbear on Thursday March 11, 2021 @09:45AM (#26424498)
We 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.
Re:Dennis Ritchie’s first C compiler (c. 1972) by siltpotato on Thursday March 11, 2021 @12:45PM (#26426785)
Before I look up `man cat`, what can you do with `cat` other than just see what's in a file?
Re:Dennis Ritchie’s first C compiler (c. 1972) by Crespyl on Thursday March 11, 2021 @03:14PM (#26428476)
When 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by Koshkin on Thursday March 11, 2021 @03:35PM (#26428700)
The backspace does work within the line.
Re:Dennis Ritchie’s first C compiler (c. 1972) by exikyut on Friday March 12, 2021 @06:06AM (#26434446)
If your terminal is in line-buffered mode.
Re:Dennis Ritchie’s first C compiler (c. 1972) by amyjess on Friday March 12, 2021 @10:52PM (#26443775)
You can join files together.

    $ cat foo bar > baz
will join the files foo and bar together into a single file called baz
Re:Dennis Ritchie’s first C compiler (c. 1972) by oblio on Thursday March 11, 2021 @09:07AM (#26424138)
That 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by compiler-guy on Thursday March 11, 2021 @10:25AM (#26424981)
We 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by pjmlp on Friday March 12, 2021 @06:50PM (#26442401)
Some would say,

https://multicians.org/history.html

Instead we pile mitigations on top of mitigations, with hardware memory tagging being the last hope to fix it.

Re:Dennis Ritchie’s first C compiler (c. 1972) by colejohnson66 on Thursday March 11, 2021 @05:59PM (#26430106)
Is there an explanation on why C’s operator precedence is weird? Such as: why does the bitwise AND have higher precedence than logical AND?
Re:Dennis Ritchie’s first C compiler (c. 1972) by compiler-guy on Friday March 12, 2021 @05:41PM (#26441847)
There is, and it is amusing

“In retrospect it would have been better to go ahead and change the precedence of & to higher than ==, but it seemed safer just to split & and && without moving & past an existing operator. (After all, we had several hundred kilobytes of source code, and maybe 3 installations....)“

https://www.lysator.liu.se/c/dmr-on-or.html

Re:Dennis Ritchie’s first C compiler (c. 1972) by briantakita on Friday March 12, 2021 @03:27PM (#26440481)
> 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by colejohnson66 on Friday March 12, 2021 @03:42PM (#26440634)
I 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.
Re:Dennis Ritchie’s first C compiler (c. 1972) by compiler-guy on Friday March 12, 2021 @05:42PM (#26441853)
See the above example from dmr himself
Re:Dennis Ritchie’s first C compiler (c. 1972) by briantakita on Friday March 12, 2021 @02:27PM (#26439814)
> that will be hobbled because of those early decisions for a long, long time.

Perhaps this is why a programmer would want to rewrite a system & tout "funny success stories" about the effort & results?

https://news.ycombinator.com/item?id=25844428

> Why couldn't you just upgrade the dependencies once then set up the same CI/CD you're presumably using for Svelte so that you can them upgrade versions easily?

Because the existing system was painful & time/energy intensive to upgrade. It happens with tight coupling, dependency hell, unchecked incidental complexity, architecture churn, leaky abstractions, etc...

Maintenance hell & > 1 month major version upgrades tend to occur with large, encompassing, first-mover frameworks, often built on a brittle set of abstractions, as they "mature" & "adapt" to the competition. e.g. Rails, Angular...

Re:Dennis Ritchie’s first C compiler (c. 1972) by tralarpa on Thursday March 11, 2021 @04:20AM (#26421995)
Was it different for the designers of ALGOL/SIMULA/Pascal?
Re:Dennis Ritchie’s first C compiler (c. 1972) by kiwidrew on Thursday March 11, 2021 @04:34AM (#26422090)
Yeah, 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.
Re:Dennis Ritchie’s first C compiler (c. 1972) by tralarpa on Thursday March 11, 2021 @06:24AM (#26422854)
Very 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.

Re:Dennis Ritchie’s first C compiler (c. 1972) by ktpsns on Thursday March 11, 2021 @06:47AM (#26423008)
Actually 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).
Re:Dennis Ritchie’s first C compiler (c. 1972) by Wildgoose on Thursday March 11, 2021 @09:25AM (#26424299)
My first usage of a computer was on a printed teletype. My last such use was probably around 1985. They were around for a long time.
Re:Dennis Ritchie’s first C compiler (c. 1972) by amyjess on Thursday March 11, 2021 @11:41AM (#26425960)
And for a lot of people, the lightbulb goes off once they realize what 'tty' stands for...
Re:Dennis Ritchie’s first C compiler (c. 1972) by pjmlp on Friday March 12, 2021 @06:53PM (#26442416)
B 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.