This wasn't mentioned in the past thread. Alex presents his ideas in my forms. This one happens to be the most terse and mathematical. That can be good, but I think "From Mathematics to Generic Programming" is much more generally approachable.
One practical skill that's shown well in this book is writing functions that solve the easiest or special cases, and then layering those into general functions which ensure the preconditions for applying one of those special cases are met. It makes very readable code, and anytime a user of the code knows they have a special case, they can assert it and use the special one for some performance advantages.
> writing functions that solve the easiest or special cases, and then layering those into general functions
This is something I've been getting the hang of in my recent playing around with Elixir. In Elixir, you can eliminate a lot of conditional logic by utilizing pattern matching in function signatures. Often, though not always, it's possible to write each of your edge cases with a single function head. In practice this usually looks like a few 1 or 2 line functions for simple cases, and then one gnarly one that does whatever checking you need to assure the right result.
It's also a great way to write recursive functions. You can pattern match on the base case - say, an empty list - and then put the recursive case or cases under separate function head.
It's a wonderfully fun and expressive language, although I have been missing static types here and there, which counterintuitively seem like they might eliminate a lot of boilerplate from my code.
Highly recommended playground for the language geek.
I was a bit put off by the introductory chapter where he is using a lot of nonstandard terms such as "abstract species/genus" rather than the usual type theoretic treatment. However, take that as the remark of an ignoramus.
There are many different backgrounds from which to explore these topics, and type theory is just one way. Also the introduction isn't really trying to formalize computation itself, but give mathematical tools for talking about algorithms.
The abstract species/genus is probably inspired more by Aristotle than CS topics.
I don't think the terms "Abstract species/genus" ever came up, but it makes me think of Introductory course to Object-Oriented Programming (Java), lecture 5: Inheritance
It's probably best to understand it the other way around: Alex had been designing generic programming libraries in assembly, and tried to move to Ada — but was stymied. Simplifying into a just-so story: he approached Bjarne about adding a set of features to C++ to allow Alex to directly express generic programming in C++. That's what led to templates, etc.
This wasn't mentioned in the past thread. Alex presents his ideas in my forms. This one happens to be the most terse and mathematical. That can be good, but I think "From Mathematics to Generic Programming" is much more generally approachable.
One practical skill that's shown well in this book is writing functions that solve the easiest or special cases, and then layering those into general functions which ensure the preconditions for applying one of those special cases are met. It makes very readable code, and anytime a user of the code knows they have a special case, they can assert it and use the special one for some performance advantages.