Graydon Hoare: 21 compilers and 3 orders of magnitude in 60 minutes
lambda-the-ultimate.org
lambda-the-ultimate.org
1. Tony Hoare - "I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years." Null References: The Billion Dollar Mistake - https://www.infoq.com/presentations/Null-References-The-Bill...
2. C.A.R. Hoare - "The most important property of a program is whether it accomplishes the intention of its user."
3. Graydon Hoare - "Rust started as a personal project (on my own laptop, on my own time) in 2006. It was a small but real 17kloc native compiler for linux, mac and windows by the time Mozilla began sponsoring it in 2009-10."
EDIT: C.A.R. = Charles Antony Richard = Tony. Not to be confused with his twin brother C.D.R.
I thought you were making a Lisp joke, and I Google for Cdr Hoare.
This is something I am guilty of too often. I get lost in fixing the minute details and edge cases that might come reality under very special circumstances only.
It is good to step back once in a while and focus on whether the thing you are working on actually has an effect on the user experience or user interaction with your product.
Don’t lose the big picture out of sight for all the small edge cases
"With the aspiring compiler designers of tomorrow in mind, Hoare’s talk spanned the history of building compilers for programming languages (He didn’t record the talk, so we have the slides to go by). He told the students he wanted to demystify that space “between class projects and industrial compilers” to “reduce terror, spark curiosity, encourage trying it as a career.”
https://thenewstack.io/rust-creator-graydon-hoare-recounts-t...
Current maintainer is Attila Lendvai https://github.com/attila-lendvai/maru/tree/piumarta
SRI-ARC: https://archive.computerhistory.org/resources/access/text/fi...
Frances Allen (RIP): https://news.ycombinator.com/item?id=24066832
why?
match expr with
| Mul (Const x, Const y) -> Const (x*y)
| Mul (x, Const 2) -> (* optimize as a left shift *)
| ... class BinOp:
def __init__(self, left, right, operator):
self.left = left
self.right = right
self.operator = operator
sum_of_ints = BinOp(left=1, right=1, operator='+')
match sum_of_ints:
case BinOp(left=int(left), right=int(right), operator='+'):
print(f'Summing int {left} + {right}')
case BinOp(left=str(left), right=str(right), operator='+'):
print(f'Concateneting strings {left} + {right}')
case _:
print('Don\'t know how to sum this')Not sure if there are any runtime checks for this?
Both ML and Lisp make it pretty easy to write out complex domain-specific data structures (like ASTs) as part of your code, but I haven't found that as valuable as you might expect when writing toy compilers.
Pattern-matching, though, that's super important. Compilers are full of case analysis of sum types, and not just in the sort of optimization transformations rwmj mentions, though in a sufficiently advanced compiler most of the code will probably be in the optimizer.
(For these purposes Python is basically a slow Lisp.)
1. These languages, having been used many times over to write compilers, have been battle-tested.
2. These languages do a good job of making immutable data structures easy to reach for and use, with escape hatches for more performant, mutable structures if need be; it's easier to reason about correctness when things are immutable by default. Correctness matters a lot for compilers.
3. Compilers are, in some sense, a bag of functions that iterate or map over trees. Pattern-matching is a way to reify trees: the branches of the trees become branches of your match expression. These languages support pattern-matching in a pervasive, first-class sort of way, as they prefer recursion and pattern matching over other kinds of control flow.
4. ML-likes have an advanced type system, while still being relatively ergonomic to write code in, as the type system admits some form of Hindley-Milner type inference. Good for correctness; but not strictly necessary for a compiler, maybe.
5. Lisp-likes don't generally have a type system (although some do!). But Lisps have extreme dynamism in the form of macros. Being able to tersely write code that expands out to exactly what you need can carry the day too. Whereas imperative languages sort of strike a compromise: their type systems are neither all that great (although C++, C#, and Java have all improved on type inferencing in the last decade) nor do they have anything as powerful as Lisp macros.
6. People and culture. Compiler people are generally made forged in academia, where it's generally taught in some Lisp or ML derivative. Type theory papers are usually written in some Haskell-like. Implementing a GHC extension is a path to a degree for grad student.
Have you both collaborated on something ?
also reread about https://en.wikipedia.org/wiki/Cogito_(software)
it's funny how like a few other projects, the original high level interface (cogito) got canned and the low level one ended up the main. I've read this about apt (which was a sub project of a big debian graphical package management) and lisp too.
Aren't we all? What's the point in saying this? I find him quite pleasant.
I'm glad to hear you get along well.
If I'm an asshole, and I recognize that I'm an asshole, but I'm either unable or unwilling to change, would you kill me if I asked it of you or society at large? I certainly don't want to be this way, but find I have little choice in the matter. Any signs of mercy for those of us who are born to suffer?
“There’s no point singling out people who steal bulk bin candies. Everyone does it.” is the sentiment that sits wrong with me.
All that is a long way of saying have some empathy at the very least and some sympathy if possible.
> How much choice do you think prickly people have in who they become?
It boils down to if you think being an asshole is congenital and impervious to efforts at self-improvement.
Personally I think we humans all hunger for love and acceptance, and a generous dose of love is Alchemical and can transmutate the lead of assholeness to the gold of beautiful conduct. So next time you see an asshole, give them a hug.
> I have little choice
As a last resort, you could always self-isolate. :}
Huh. I wonder if that played a part in Torvald’s being open to Rust in the Linux kernel.
In particular, Rust is less error-prone than C, rather than more so (as is arguably the case for C++), and it does not require the importation of a large runtime into the kernel. And, unlike for example Lua or Scheme, a number of kernels have already been written in Rust, some of which are already fairly full-featured: https://github.com/flosse/rust-os-comparison
Regardless, you are right to point out two of his contributions that have left an indelible mark on our industry.
I'm glad to hear you got along well.
Huh? They both use content-addressing (identify everything by its hash) which leads to the nice property that history is cryptographically immutable, but at least Mercurial also does (and is also older than Git).
But other than that, they're fairly different.
The concept of what a branch is is fundamentally different. In Git, it's a pointer to a revision, and has a home (it's mutable scalar that a URI could point to). In Monotone, a branch is "all revisions - whether or not you know about them - that have a certificate that you trust that says they're in that branch".
(I describe that as Monotone being distributed as in Usenet, while Git is federated as in Email.)
Monotone treats a file as an object (so it can be explicitly renamed or deleted), where Git only has "this tree has a file at this location" and then can infer renames or deletes or creates (or copies or splits or whatever).
Plus of course there's the whole "monotone uses SQLite" thing.