From Tony Hoare to Graydon Hoare

⚓ Rust    📅 2025-07-18    👤 surdeus    👁️ 3      

surdeus

Ever since I discovered Rust and that it was initiated by Graydon Hoare I have wondered if there was any relation to my hero Tony Hoare. I find no family relationship but today I find a curious conceptual connection.

In 1966 Tony wrote a paper called "RECORD HANDLING". In which he describes what sounds a lot like Rust's enums and match statements. He says:

In the real world, it is often useful to consider a class of object as being split into a number of mutually exclusive subclasses. For example, the class of algebraic expressions will include constants, variables, and dyadic expressions..

And gives as example (I assume pseudo code):

record class expression (
  subclasses
    constant (real value),
    variable (string printname),
    ...
);

And goes on to say:

...the programmer will usually at some stage wish to determine to which of the possible subclasses the record currently referenced by that variable actually belongs. This can be achieved by a construction known as a record class discriminator...

With example:

consider e when constant then ...
           when variable then ...
           when pair then ...

Saying:

Thus within each of the sections program, the variable e may safely be used in field designators for private fields of the relavent subclass, exactly as if it had been restricted by declaration to point only to records of that subclass.

Well, holy s**t, if that is not enum and match in Rust. It took forty years for this to get from Tony Hoare to Rust. And 54 years to get to me discovering Rust and immediately falling in love with enums and match!

Yeah, I know some will say such things existed in other languages along the way. I don't care, they were not main stream, at least not anywhere near my career path. Such ideas were rejected from C++ in favour of inheritance and virtual methods etc.

For anyone interested in such history I get all this from a recent presentation by Casey Muratori on YouTube: "The Big OOPS : Anatomy of a Thirty-five-year Mistake". Which has a lot of other gems in it. It's over two hours long! https://www.youtube.com/watch?v=wo84LFzx5nI

All this starts to explain why I was immediatley atracted to and comfortable with Rust, a feeling I had not had since starting out with ALGOL back in the day. A language that Tony Hoare had a lot to do with and had an emphasis on "doing the right thing".

2 posts - 2 participants

Read full topic

🏷️ rust_feed