4
4
## Reflections on Trusting Trust
5
5
6
6
[ Ken Thompson] [ ken ] did many wonderful things. Probably more
7
- than any programmer, he influenced the programming style which we have right
7
+ than any programmer, he influenced the programming style which we have right
8
8
now. While he did not invent C, that was done by his friend [ Dennis Ritchie] [ dennis ] ,
9
9
he invented the programming style which underlies C.
10
10
Dealing with pointers,
@@ -18,7 +18,7 @@ have to be abolished[^hoare-speech].
18
18
The idea was that pointer is illegitimate thing.
19
19
Language designers were fully convinced that
20
20
even if you provide pointers nobody should call them pointers.
21
- They would call them something like [ access types] [ access-types ] .
21
+ They would call them something like [ access types] [ access-types ] .
22
22
They have to prohibit iterations, like you could never subtract pointers.
23
23
[ Niklaus Wirth] [ wirth ] , the designer of Pascal, was very certain that you should never allow
24
24
subtraction between pointers.
@@ -40,7 +40,7 @@ So Ken made them practical[^minsky].
40
40
41
41
Then he did UNIX, this totally brilliant operating system on which we all rely.
42
42
All of our livelihoods come from Ken, in one shape or form.
43
- Do you remember the [ fortune cookie program] [ fortune ] ?
43
+ Do you remember the [ fortune cookie program] [ fortune ] ?
44
44
One of the fortune cookies was: "it is all Ken's fault"[ ^ fortune-quote ] .
45
45
We have to remember that.
46
46
@@ -50,7 +50,7 @@ Mind it, at that point as far as I know he
50
50
barely knew the moves.
51
51
There was total dominance by Russian chess playing
52
52
program [ Kaissa] [ russia-chess ] and two or three years he builds this specialized hardware,
53
- totally revolutionizes the approach to just playing.
53
+ totally revolutionizes the approach to just playing.
54
54
Of course nobody remembers
55
55
what Kaissa was.
56
56
He is a guy who could enter in a
@@ -68,7 +68,7 @@ years of their collaboration not once they would attempt to do the same thing.
68
68
They had this good sense to work on complementary things.
69
69
Except once.
70
70
Both of them needed to write an assembly program with about
71
- 20 lines of code and continues Ken, "I checked it was character by character
71
+ 20 lines of code and continues Ken, "I checked, it was character by character
72
72
identical".
73
73
It sounds like mystical thing right, two people coming together,
74
74
this is a Vulcan mind-meld (joke).
@@ -94,10 +94,10 @@ Imagine how wonderful it would be if you could understand what someone else wrot
94
94
95
95
[ ^ fortune-quote ] : I have been unable to find any reference to this quote.
96
96
Some older fortune files
97
- such as [ this file] [ plan-9-fortune ] from plan-9 contain similar quotes,
97
+ such as [ this file] [ plan-9-fortune ] from plan-9 contain similar quotes,
98
98
such as "Maybe I should have screwed up"
99
99
100
- [ ^ dennis ] : Alex: In my opinion Dennis wasn' at genius like Ken,
100
+ [ ^ dennis ] : Alex: In my opinion Dennis wasn't a genius like Ken,
101
101
but obviously first class.
102
102
103
103
[ ^ teaching-programming ] : Alex: At Stanford there's one guy who knows, but he's an emeritus (Donald Knuth).
@@ -141,7 +141,7 @@ Part of what I am trying to do here is to start discussing
141
141
little things like, how do we name variables?
142
142
Why is it important? We want to get to the point where
143
143
everybody writes a consistent code, recognizable code.
144
- This is why I'm I want to go slow and develop so that we
144
+ This is why I want to go slow and develop so that we
145
145
all agree[ ^ conventions ] .
146
146
147
147
We have to start with a very very simple program. Most of you recognize it, right? [ Hello World] [ hello-world ] .
@@ -268,18 +268,17 @@ That is a lot.
268
268
One possible algorithm is using a lookup table.
269
269
For example, one could allocate an array with ` 2^32 ` entries and count how many times integers are found only once.
270
270
271
-
272
- [ ^ big-oh ] : To say a function ` f ` is ` O(g) ` it's only required that ` f ` be bounded
273
- by a constant multiple for all inputs beyond some point.
271
+ [ ^ big-oh ] : To say a function ` f ` is ` O(g) ` it's only required that ` f ` be bounded
272
+ by a constant multiple for all inputs beyond some point.
274
273
Formally, if ` f(x) <= Ag(x) ` for all ` x > M ` , where ` A ` and ` M ` are constant real numbers
275
274
(see "The Art of Computer Programming" 1.2.11).
276
275
277
276
Alex will tend to say "order of" to distinguish ` O(f) ` from exactly ` f ` .
278
277
In this section, Alex is observing that there is no requirement for ` A ` to be small.
279
278
280
279
[ ^ headers ] : Alex: You didn't use to need ` #include <set> ` when I first did STL.
281
- I had one gigantic a file called ` stl.h `
282
- At that time people said it's utterly unacceptable to twenty thousand lines of code.
280
+ I had one gigantic file called ` stl.h `
281
+ At that time people said it's utterly unacceptable, you have twenty thousand lines of code.
283
282
If you think about it nowadays it appears to be very funny. Twenty thousand is nothing.
284
283
That's why ` stl.h ` was replaced with a gazillion little headers.
285
284
Sometimes I have no idea what they are.
@@ -289,7 +288,7 @@ That is a lot.
289
288
Some of you think it was a great language.
290
289
They carefully designed a bunch of algorithms which work on arbitrary sequences
291
290
and one of the algorithms was called [ ` remove-duplicates ` ] [ clhs-duplicates ] and it relied on equality.
292
- It actually would go through ` N ` times rremoving things.
291
+ It actually would go through ` N ` times removing things.
293
292
They did not sort.
294
293
They use equality.
295
294
It did work and it worked exceptionally well for most of the applications.
@@ -365,15 +364,15 @@ Miracles are not possible.
365
364
If you ask somebody to create a very
366
365
complex data structure that's what you're going to get.
367
366
You're going to get problems with node allocation.
368
- You are going to problems with rebalancing.
367
+ You are going to get problems with rebalancing.
369
368
You're going to get problem with whatever these advanced data
370
369
structures do.
371
370
These problems are going to get worse and worse.
372
371
You're going to get a [ cache miss] [ cache ] on every step through the set.
373
372
374
- As our computers become faster, faster, and faster they're getting slower and
373
+ As our computers become faster and faster and faster they're getting slower and
375
374
slower and slower[ ^ slower ] .
376
- Meaning that going to the main memory is very slow.
375
+ Meaning that going to the main memory is very slow.
377
376
You want to have locality of reference. You want all your
378
377
data that you are working on in the local cache. If you have a huge set or map it's not
379
378
going to be like that.
@@ -407,7 +406,7 @@ You need a `set` only if you need a thing which does not move things around.
407
406
As long as something gets into a ` set ` and it is not erased the pointer, it is fixed.
408
407
For example, him sitting in this chair is in the ` set ` .
409
408
As long as he's in this set he will not move from his chair.
410
- You could find him constant time.
409
+ You could find him in constant time.
411
410
It's a very useful thing except most people do not use set for that.
412
411
413
412
[ ^ slower ] : This performance description is based on several trends in computer architecture.
0 commit comments