Earlier quoted context omitted.
> 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
It is just a classical Dijkstra strawman - hiding a weak argument behind painting everybody else as idiots. In fact it is much easier to make dangerous undetected mistakes in C than it is in Python.
The Manuscripts of Edsger W. Dijkstra
101–110 of 129 posts
Re: The Manuscripts of Edsger W. Dijkstra
#102Earlier quoted context omitted.
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.
One should always use a single kind of half-open range, i.e. with the start closed and the ending open. The whole point here is to use a single kind of range, without exceptions, in order to avoid the errors caused by using the wrong type of range for the context. For backwards iteration the right range is [-1,-1-n), i.e. none of those listed by you. Like for any such range, the number of accessed elements is the dif…
The supposed advantage of 0-based indexing with half-open ranges is that the programmer wouldn't have to add ±1 to the loop bounds as often as they would with 1-based indexing. But backwards iteration is an example where that's not the case. The open range calls for a bound of n-1 or -1-n, whereas with closed ranges it would be just n.
Re: The Manuscripts of Edsger W. Dijkstra
#103Earlier quoted context omitted.
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!
The patient-0 terminology arose from a misreading of the label patient-O, where O is the letter O. When numbering discrete elements you usually start with 1, so first is 1, second is 2 etc. Indexes in C are not ordinal numbers though, they should be thought of as offsets or distances from the first element. So [0] is 0 steps away from the first element, hence the first element. The confusion arise when you think thes…
Re: The Manuscripts of Edsger W. Dijkstra
#104Earlier quoted context omitted.
Setting aside the the elephant in the room (modern coding LLMs are in some sense indeed compilers for natural language -- except they still "compile to" ordinary programming languages) it nonetheless seems to me that even conventional programming languages use too little, not too much, natural language. Example: - "&&" rather than "and", - "||" rather than "or", - "if (A) B" rather than "if A then B" This only makes…
I suspect Dijkstra would have disagreed with you about "and" and "or", judging from his criticism of the technical report which had the line "even the standard symbols used for logical connectives have been avoided for the sake of clarity". Personally I think one advantage of '&&' and '||' is that it's clear they're a notation that you need to know the syntax and semantics of. For instance typically '&&' is "short-ci…
> More generally, I'm not sure of the benefit of tailoring the language syntax for beginners rather than experienced practitioners; the advantage of '&&', '||' and the rest of the "C-like" syntax stuff in a new language is that it's familiar to a wide base of existing experienced programmers.
At one point in time every awkward and outdated syntax was the more familiar option, but that's of course not a good argument not to improve it, otherwise we would be stuck with it forever.
Re: The Manuscripts of Edsger W. Dijkstra
#105Earlier quoted context omitted.
It's the requirements discovery phase that always breaks every pure mathematical treatment of software development. (And also, like DW points, that software is way more complex. But on this case, it's the requirements discovery.)
That’s because it’s not pure math, but applied math. Which also has the requirements discovery phase.
Re: The Manuscripts of Edsger W. Dijkstra
#106Earlier quoted context omitted.
It is just a classical Dijkstra strawman - hiding a weak argument behind painting everybody else as idiots. In fact it is much easier to make dangerous undetected mistakes in C than it is in Python.
I downvoted you. First of all, your explanation of what "classical Dijkstra strawman" is lacks the substantiation. Second, your statement about C vs Python is a sort of strawman itself in the context of static vs dynamic typing. You should compare Python with things like Java, Rust or Haskell. (Or C with dynamic languages from similar era - LISP, Rexx, Forth etc.)
Re: The Manuscripts of Edsger W. Dijkstra
#107Something 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.
Positions in sequences like arrays are referred to using ordinal numbers (first, second, third, ...). There is no ordinal "zeroth". Ordinal numbers start at 1. This is contrary to cardinal ("how many?") numbers, which start at 0. And talking of "natural" numbers is besides the point. Therefore, referring to the seventh element in a sequence with the name "6" rather than "7" is confusing and provokes off-by-one errors.
Re: The Manuscripts of Edsger W. Dijkstra
#108Earlier quoted context omitted.
I downvoted you. First of all, your explanation of what "classical Dijkstra strawman" is lacks the substantiation. Second, your statement about C vs Python is a sort of strawman itself in the context of static vs dynamic typing. You should compare Python with things like Java, Rust or Haskell. (Or C with dynamic languages from similar era - LISP, Rexx, Forth etc.)
It is a strawman because nobody actually equates the ease of programming with the ease of making undetected mistakes.
Re: The Manuscripts of Edsger W. Dijkstra
#109Earlier quoted context omitted.
I agree with all of this. The original discussion was regarding there's no such thing as a zeroth X, and what I've been trying to say this whole time is sure there is, it's the beginning. Which is why you start counting time from 0. Interesting about patient-O though. I didn't know that. My previous comment may have seemed snarky, but that wasn't my intention. I tried to originally write something that didn't seem sa…
OK but I’m not sure I get your point then. Are you saying Edwin Aldrin was the first man on the moon because Neil Armstrong was the zeroth?
If we ask who was on the moon before them then the answer is nobody.
I think that’s agreeable. So then what am I talking about? It’s just counting.
I’m going to explain this to whomever is interested, and anyone is free to tell me where I made a mistake, in which case I will thank them for the correction.
When we talk about counting we say we are talking about things like numbers. We also talk about things, because you count things. And so counting is numbers of things. Like the number of ways to combine two dice rolls is a problem for counting.
One property of counting is that the numbers and the thing counted are separate. In other words the thing being counted does not matter when we are counting, as long as they are countable. I think that much is clear. Numbers work the same regardless of the thing being counted.
So let’s then define how counting works. Let’s say the cardinality of a set determines the “nth-ness” of the number, and the kinds of things the set holds inside is how we determine the thing we’re counting. Together, the type of thing the set holds + it’s cardinality is how we say the nth-ness of the thing being counted.
Remember the thing and the number are separate from each other, and that the count ability is also crucial. It’s the cardinality that determines the nth-ness of the count.
So then let’s count astronauts using our rule and determine who is the nth astronaut. Neil is first because when he landed on a moon, the set of all moon landers had a cardinality of 1. And buzz is second because when he landed on the moon the size of the set of moon landers is 2. Size of a set and cardinality are the same.
A set can also be empty. This set has a cardinality of 0.
So what was the set of moon landers before Neil? It was empty. In other words, there was nobody on the moon. So if we apply our rule we say that nobody was the zeroth person on the moon.
You might say that doesn’t make sense because nobody isn’t a person, but the problem is that’s a concern for the thing and not the number. We said they are separate things.
In this case we are only really interested in the nth-ness of the number and the kind of thing the set holds.
While nobody is not a person, the empty set itself definitely exists and it definitely has a cardinality of 0.
So the zeroth person on the moon was nobody. The zeroth mile is no mile. The zeroth century is no century. Some of the these things might make sense to you and some might not. But the sense that they have or don’t have in those case stem from how we think about the thing and less about the number.
I’ll give my final example.
An experiment starts at time t0. The zeroth second. Each second that is completed grows the size of our set of seconds. Nonetheless when the experiment began the set was empty. That was the zeroth second.
It’s not an actual second, but that doesn’t matter you can still count it. No second doesn’t exist but the empty set of second does and it can be counted. And in fact it’s really hard to explain counting at all if you don’t have a concept of zeroth.
That is why a zero-day exploit is called what it is because not one full day has passed since its existence has been revealed. Would first day also work, yes that’s fine colloquially but zeroth day is definitely not wrong is what I’m saying.
That is why we start the day at 00:00 in military time. Because what the time of a day means is the size of the set of hours, minutes, second, etc… that have passed. But the count starts at the empty set.
Here’s a very funny and confusing example: The day you are born is not your first “birth day”, because a “birth day” means anniversary of your birth. However the day you are born is the empty set from which that count begins. Birth day in this sense is an overloaded term in English but in many languages it’s literally called birth anniversary.
Anyways, that’s what I have to say. Probably much more than anyone wanted or needed but I hope it was at least clear what I think. If I’m mistaken then let me know.
Re: The Manuscripts of Edsger W. Dijkstra
#110Something 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.
He ignores this basic argument: Positions in sequences like arrays are referred to using ordinal numbers (first, second, third, ...). There is no ordinal "zeroth". Ordinal numbers start at 1. This is contrary to cardinal ("how many?") numbers, which start at 0. And talking of "natural" numbers is besides the point. Therefore, referring to the seventh element in a sequence with the name "6" rather than "7" is confusin…