Live data from Hacker News

Dennis Ritchie’s first C compiler (c. 1972)

github.com

71–80 of 163 posts

Re: Dennis Ritchie’s first C compiler (c. 1972)

#71
post #69
post #64

Earlier quoted context omitted.

And what does it mean there? (automatic storage duration)

Do you mean automatic type deduction? Edit : I know it’s also storage specifier but it also does type deduction here, hope I’m not confused with the terminology

It doesn't do type deduction there.

In original C you could declare variables without a type, and these variables with auto have no type.

So this "auto" is essentially saying "this variable without a type uses automatic storage". That's a completely different language feature from "deduce the type of this variable".

Re: Dennis Ritchie’s first C compiler (c. 1972)

#72
post #66
post #42

Earlier quoted context omitted.

It makes sense long would have needed a comment. It needs a comment because “long” and “double” are terrible names for data types. Long what ? Double length what ? Those type names could easily have opposite meanings and meant long floating point / double length integer. WORD/DWORD are nearly as bad - calling something a "word" incorrectly implies the data type has something to do with strings. If you don't believe m…

> ask a non programmer Why should a non programmer understand programming terms? Words have different meanings in different contexts. That's how words work. There is no need to make these terms understandable to anyone. The layman does not need to understand the meaning of long or word in C source code. Ask a non-golf player what is an eagle or ask a physicist, a mathematician and a politic the meaning of power. Word…

Good variable names (and type names) matter for legibility. They should be clear, unambiguous, short, memorable and suggestive. Unambiguous is usually more important than short and memorable.

The word 'long' is ambiguous and unmemorable. And the type "word" is actively misleading. If you called a variable or class 'long', it wouldn't pass code review. And for good reason.

'Power' is an excellent example of what good technical terms look like. "Power" has a specific technical meaning in each of those fields, but in each case the technical meaning is suggested by the everyday meaning of the word "power". Ask a non-physicist to guess what "power" means in a physics context and they'll probably get pretty close. Ask a non-programmer to guess what "integer" means in programming and they'll get close. Similarly computing words like "panic", "signal", "file", "output", "stream", "motherboard" etc are great terms because they all suggest their technical meaning. You don't have to understand anything about operating systems to have an intuition about what "the computer panicked" means.

Some technical terms you just have to learn - like "GPU" or "CRDT". But at least those terms aren't misleading. I have no problem with the term "double precision floatingpoint" because at least its specific.

"long", "double", "short" and "word" are bad terms because they sound like you should be able to guess what they mean, but that is a game you will lose. And to make matters worse, 'long', 'double' and 'short' are all adjectives in the english language, but used in C as nouns[1]. They're the worst.

[1] All well named types are named after a noun. This is true in every language.

Re: Dennis Ritchie’s first C compiler (c. 1972)

#73
post #42

The original keywords - https://github.com/mortdeus/legacy-cc/blob/master/last1120c/... Interestingly, long was commented

It makes sense long would have needed a comment. It needs a comment because “long” and “double” are terrible names for data types. Long what ? Double length what ? Those type names could easily have opposite meanings and meant long floating point / double length integer. WORD/DWORD are nearly as bad - calling something a "word" incorrectly implies the data type has something to do with strings. If you don't believe m…

Yes, int_16/int_32 or something like that makes a lot more sense. Today, not when this compiler was written.

The PDP-9, PDP-10, and PDP-18 have 18 bits registers. The world had not settled on 16/32/64 bits at all.

Even the intel 80286 far/fat pointers are 24 bits.

Re: Dennis Ritchie’s first C compiler (c. 1972)

#74

Earlier quoted context omitted.

Was it different for the designers of ALGOL/SIMULA/Pascal?

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.

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)

#75
post #69
post #64

Earlier quoted context omitted.

And what does it mean there? (automatic storage duration)

Do you mean automatic type deduction? Edit : I know it’s also storage specifier but it also does type deduction here, hope I’m not confused with the terminology

No, it doesn't do type deduction. Without specifying the type, it assumes a type of int. Everything in C revolves around ints.

Re: Dennis Ritchie’s first C compiler (c. 1972)

#76
post #26

Earlier quoted context omitted.

I like that the Bootstrappable Builds folks are working on a bootstrap process that goes from a small amount of machine code (~512 bytes) all the way up to a full Linux distro, including compilers/interpreters for modern languages. https://bootstrappable.org/

Nice, I hadn't heard of this project before! In particular BOOTSTRA [1] looks really fun. I have also toyed with the idea of using MS-DOS 3.30 as a guaranteed-ubiquitous build environment. It comes with a filesystem, a text editor (EDLIN.EXE), an object file linker (yup!), a debugger/assembler (DEBUG.EXE is an amazing tool), a programming language with decent string handling (GWBASIC.EXE), and a command interpreter w…

I don't think that BOOTSTRA is in any way involved in the process bootrappable.org are working on, which starts with hex0 (the 512B machine code binary seed), proceeds through a ton of layers and eventually reaches non-interactive bash.

https://github.com/fosslinux/live-bootstrap/blob/master/part...

Re: Dennis Ritchie’s first C compiler (c. 1972)

#77
post #71
post #69

Earlier quoted context omitted.

Do you mean automatic type deduction? Edit : I know it’s also storage specifier but it also does type deduction here, hope I’m not confused with the terminology

It doesn't do type deduction there. In original C you could declare variables without a type, and these variables with auto have no type. So this "auto" is essentially saying "this variable without a type uses automatic storage". That's a completely different language feature from "deduce the type of this variable".

Thanks.

Re: Dennis Ritchie’s first C compiler (c. 1972)

#78

Earlier quoted context omitted.

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.

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...…

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)

#79
post #72
post #66

Earlier quoted context omitted.

> ask a non programmer Why should a non programmer understand programming terms? Words have different meanings in different contexts. That's how words work. There is no need to make these terms understandable to anyone. The layman does not need to understand the meaning of long or word in C source code. Ask a non-golf player what is an eagle or ask a physicist, a mathematician and a politic the meaning of power. Word…

Good variable names (and type names) matter for legibility. They should be clear, unambiguous, short, memorable and suggestive. Unambiguous is usually more important than short and memorable. The word 'long' is ambiguous and unmemorable. And the type "word" is actively misleading. If you called a variable or class 'long', it wouldn't pass code review. And for good reason. 'Power' is an excellent example of what good…

"long" and "short" are adjectives in C. The types are "long int" and "short int" and the "int" is implied if it's not present. A declaration like

    auto long sum;
Declares a variable named "sum" of type "long int" and of automatic storage duration.

The "double" comes from double-precision floating point. In the 1970s and 1980s anyone who came near a computer would know what that meant. Anyone who ever had to use a log table or slide rule (which was anyone doing math professionally) would know exactly what that meant.

There are good sound reasons for the well-chosen keywords. Just because one is ignorant of those reasons does not mean they were not good choices.

Re: Dennis Ritchie’s first C compiler (c. 1972)

#80
post #60

Earlier quoted context omitted.

Float doesn't make sense either. What is floating? (I know it's floating point, but it's the same as long/double).

String doesn’t make sense either. But that’s how words acquire new meanings.

It's short for "Hollerith string". Nobody wants to type out that man's name every time they want to deal with the data type. Also, most programmers know zero about computer science.
Post reply on HN