Live data from Hacker News

The Manuscripts of Edsger W. Dijkstra

cs.utexas.edu

61–70 of 129 posts

Re: The Manuscripts of Edsger W. Dijkstra

#61
post #7

The most important one in the context of 2025 is this one: On the foolishness of "natural language programming". https://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD667...

I love that essay. It's such a joy to read, and even though it is very short and to the point it says so much both about the topic itself and society at large. And its just so obviously correct.

It is not obviously correct. The unstated premise is that programming is - or should be - similar to writing mathematical proofs.

Re: The Manuscripts of Edsger W. Dijkstra

#62
post #52
post #47

Earlier quoted context omitted.

I've read them all. While they are fun to read as their commentary come from a place of logic, there is a lot of emotion baked in and little room for being open minded about potential alternatives that could find their ways to reality. Dijkstra was very smart but you can tell thinking is a little closed, which is not objectively bad, but it happens a little too much for my taste.

I love Dijkstra’s writings, but, yes, he had very strong opinions that at times were abrasive. Alan Kay said it best when he said, “arrogance in computer science is measured in nano-Dijkstras.” Some famous Dijkstra quotes: “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” “Obje…

[deleted]

Re: The Manuscripts of Edsger W. Dijkstra

#63
post #54
post #5

Something which I occasionally link to, is this: https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF >. It not only shows why computer languages should start their indexes at 0 (instead of 1), but also shows why intervals should be specified as lower-inclusive and upper-exclusive.

That particular EWD is one of my pet peeves, because of how it always pops up in discussion about array indexing. There are several situations where 1-based indexing is better, but which Dijkstra doesn't mention. For instance, one-based is much better for iterating backwards. I think a compelling argument can be made that 0-based is better for offsets and 1-based is better for indexes, and that we should not think of…

And Dijkstras argument is actually quite weak if you read carefully. But he has a certain way of writing which make it seem almost like a mathematical proof. And then he sprinkles some “only smart people agree with me” nerd baiting.

Re: The Manuscripts of Edsger W. Dijkstra

#64
post #54
post #5

Something which I occasionally link to, is this: https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF >. It not only shows why computer languages should start their indexes at 0 (instead of 1), but also shows why intervals should be specified as lower-inclusive and upper-exclusive.

That particular EWD is one of my pet peeves, because of how it always pops up in discussion about array indexing. There are several situations where 1-based indexing is better, but which Dijkstra doesn't mention. For instance, one-based is much better for iterating backwards. I think a compelling argument can be made that 0-based is better for offsets and 1-based is better for indexes, and that we should not think of…

One-based is not better for iterating backwards.

Zero-based indexing is naturally coupled with using only half-open ranges.

When using zero-based indexing and half-open ranges, accessing an array forwards, backwards or circularly is equally easy.

In this case you can also do like in the language Icon, where non-negative indices access the array forwards, while negative indices access the array backwards (i.e. -1 is the index of the last element of the array, while 0 is the index of the first element).

In languages lacking the Icon feature, you just have to explicitly add the length of the array to the negative index.

There is absolutely no reason to distinguish offsets and indices. The less distinct kinds of things you need to keep in mind, the less chances for errors from using the wrong thing. Therefore one should not add extra kinds of things in a programming language, unless there is a real need for them.

There are things that are missing from most languages and which are needed, e.g. separate types for signed integers, unsigned integers, modular numbers, bit strings and binary polynomials (instead of using ambiguous unsigned integers for all the 4 latter types, which prevents the detection of dangerous errors, e.g. unsigned overflow), but distinguishing offsets from indices is not a useful thing.

Distinguishing offsets and indices would be useful only if the set of operations applicable to them would be different. However this is not true, because the main reason for using indices is to be able to apply arithmetic operations to them. Otherwise, you would not use numbers for indexing, but names, i.e. you would not use arrays, but structures (or hash tables, when the names used for access are not known at compile time).

Re: The Manuscripts of Edsger W. Dijkstra

#65
post #7

Earlier quoted context omitted.

I love that essay. It's such a joy to read, and even though it is very short and to the point it says so much both about the topic itself and society at large. And its just so obviously correct.

It is not obviously correct. The unstated premise is that programming is - or should be - similar to writing mathematical proofs.

The proofs/programs (Howard/Curry) correspondance has been fairly well established I think.

Re: The Manuscripts of Edsger W. Dijkstra

#66

The most important one in the context of 2025 is this one: On the foolishness of "natural language programming". https://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD667...

> when judging the relative merits of programming languages, some still seem to equate "the ease of programming" with the ease of making undetected mistakes.

This hits so hard. cough dynamic typing enthusiasts and vibe coders cough

Re: The Manuscripts of Edsger W. Dijkstra

#67
post #54

Earlier quoted context omitted.

That particular EWD is one of my pet peeves, because of how it always pops up in discussion about array indexing. There are several situations where 1-based indexing is better, but which Dijkstra doesn't mention. For instance, one-based is much better for iterating backwards. I think a compelling argument can be made that 0-based is better for offsets and 1-based is better for indexes, and that we should not think of…

And Dijkstras argument is actually quite weak if you read carefully. But he has a certain way of writing which make it seem almost like a mathematical proof. And then he sprinkles some “only smart people agree with me” nerd baiting.

This is a matter of opinion. I consider Dijkstra's arguments quite strong.

Some decades ago, I have disassembled and studied Microsoft's Fortran compiler.

The fact that Fortran uses 1-based indexing caused a lot of unnecessary complications in that compiler. After seeing firsthand the problems caused by 1-based indexing I have no doubt that Dijkstra was right. Yes, the compiler could handle perfectly fine 1-based indexing, but there really was no reason for all that effort, which should have been better spent on features providing a serious advantage for the programmer.

The use of 1-based indexing and/or closed intervals, instead of consistently using only 0-based indexing and half-open intervals, are likely to be the cause of most off-by-one errors.

Re: The Manuscripts of Edsger W. Dijkstra

#68
post #54

Earlier quoted context omitted.

That particular EWD is one of my pet peeves, because of how it always pops up in discussion about array indexing. There are several situations where 1-based indexing is better, but which Dijkstra doesn't mention. For instance, one-based is much better for iterating backwards. I think a compelling argument can be made that 0-based is better for offsets and 1-based is better for indexes, and that we should not think of…

One-based is not better for iterating backwards. Zero-based indexing is naturally coupled with using only half-open ranges. When using zero-based indexing and half-open ranges, accessing an array forwards, backwards or circularly is equally easy. In this case you can also do like in the language Icon, where non-negative indices access the array forwards, while negative indices access the array backwards (i.e. -1 is t…

The problem is that half-open ranges work best when you the start is closed and the ending is open. In forward iteration we use [0,n) but for backwards iteration we have to use (-1, n-1] or [0,n-1], both of which are kinda clunky.

Re: The Manuscripts of Edsger W. Dijkstra

#69
post #49
post #5

Something which I occasionally link to, is this: https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF >. It not only shows why computer languages should start their indexes at 0 (instead of 1), but also shows why intervals should be specified as lower-inclusive and upper-exclusive.

While I don’t disagree with his argument for preferred conventions in an era of accumulators/gp registers, I am surprised he didn’t call out why Fortran used 1, The IBM 704's index registers were decrementing, subtracting their contents from an instruction's address field to form an effective address. Type A instructions had a three bit tag, indicating which index registers to use. With those three indexes you get Fo…

FORTRAN was defined a few years before IBM 704 (in 1954).

The use of 1-based indexing was just inherited from the index notation used for vectors and matrices in most mathematical journals at that time.

When IBM 704 was designed (as the successor of IBM 701 and taking into account the experience from IBM NORC), it was designed to allow an efficient implementation of FORTRAN, not vice-versa.

The column-major ordering of FORTRAN allows more efficient implementations of the matrix-vector and matrix-matrix products (by reading the elements sequentially), when these operations are done correctly, i.e. not using the naive dot product definitions that are presented in most linear algebra manuals instead of the useful definitions of these operations (i.e. based on AXPY and on the tensor product of vectors).

Re: The Manuscripts of Edsger W. Dijkstra

#70
post #58

Earlier quoted context omitted.

Ok as soon as you start walking your are in the first block, I agree. So then where are you before that? What block were you at before you started moving, when you were giving directions? What is the name of the block from which you left to enter the first block? Before you started walking I mean. And mustn’t that block be before that other first? When we move from where we start we count up, so then mustn’t an earli…

Before starting to walk, you were at the start of the first block, not at zeroth block. There is no block prior to first block. Otherwise that block would be called as first block. Think of jogging on a road. When you are at the beginning of the road, you are at the start of the first mile, not in the zeroth mile. It doesn't have one more mile prior to first mile.

O you’re right. How could I forget the first minute of each day is 12:01, or that a previously unknown computer exploit is called a 1-day exploit.

And everybody knows a pandemic starts with patient 1!

Post reply on HN