If you're looking for a book on statically typed functional languages, I think Appel's book[1] is canon. From what I've heard, the C and Java ones aren't very great. It's worth learning enough ML to get through that version because ML is clearly the language Appel thinks in.
I assume you're talking about something like "Modern Compiler Implementation in ML"? That book is still a good starting point, and once you get a basic implementation going you'll be in a good position to start learning about and implementing more advanced features. You'll end up teaching yourself as you figure out how to add features to your own codebase.
edit: fix title
If you're focused on benchmark numbers, dynamically typed languages are much more challenging to squeeze performance out of better code generation.
You can also add static type inference and consistency checking to a dynamic language, and indeed some systems do in the name of better
Add in a static typing, type inferencing, and type checking, and that all becomes much more complicated, at least from this learner's point of view. From how highly upvoted my comment is, I suspect I'm far from being alone here. Learning, understanding, and implementing Hindley-Milner by itself was harder for me than learning how to put together a basic interpreter for a simple scheme. And I think a big part of that is the dearth of learning materials for things like Hindley-Milner and related concepts, whereas there are 100 books and tutorials on how to implement a Scheme interpreter in language X.
Finally, if you're talking about language performance, then yes clearly it's much harder to squeeze performance out of dynamic languages. But I'm talking about learning exercises here, not production programming languages.
dearth of learning materials for things
like Hindley-Milner
What's wrong with the original paper [1]? It's really basic and boiled down to the essence (in true Milner style). I give it to all my students interested in typing systems as first paper. (There is a typo on Page 211.)[1] L. Damas, R. Milner, Principal type-schemes for functional programs.
ex:
map : ∀α ∀β ((α → β) → (α list → β list))
Which I previously couldn't read, but I could easily explain the concept.[0] - Former C# language designer, Roslyn compiler team, etc.
https://www.reddit.com/r/programmerchat/comments/37qwmm/i_am...
The thought that somebody would not be able to understand the type of map had not occurred to me, because I'm surrounded by people with a strong maths/FP background. Shows just how narrow-minded I am.
- How to ensure that the inference algorithm is correct.
- How to design typing systems that are expressive, yet lightweight, and have enough type inference to be usable in practise.
- How to deal with concurrency and parallelism.
None of these problems is really solved. In practise even making type inference fast is a challenge, e.g. in older versions of the Scala compiler, type inference was really slow due to implicits.
Pierce's book is as approachable as you're likely to see with respect to type systems. You mostly just have to dig in.
But it seems to be there's a place for a more popular book on type systems and making a statically-typed language, in the vein of this Crafting Interpreters book (and others like it).
Perhaps I'll read TaPL, write a nice statically-typed language, and then write the book I'm looking for.
I think you can replace the math with intuitive diagrams and be a little less rigorous and that would be a book for the masses.
TaPL requires you to learn a lot between coding sessions too which may put off more practically minded folk.
If I wanna to implement a dialect of ML, I haven't' find a simple explanation in how implement product/sum types, modules & pattern matching.
Yet, tons of type inference and other less common things.
ie: The basics stop fast and suddenly jump into something else.
Exactly. I mean, how in the world to implement pattern matching in ML-like languages? And ADTs? These are exactly the kind of subjects I'd like to see covered in a more advanced book on building interpreters or compilers for statically-typed languages.
* simply typed lambda calculus
* Hindley-Milner type inference
* bidirectional typing
After that, there are all sorts of cool things like linear/affine types, system F, dependent types, etc. which can be picked up.All of this (except maybe the first part) is easily learnable either from Wikipedia, the original papers, or recent tutorials.
It's (hopefully) very well commented, so it should clarify a bunch of concepts for newcomers.
https://www.cs.cornell.edu/courses/cs4110/2016fa/schedule.ht...
Are static type systems more advanced than dynamic type systems? This sounds surprising, given how much more one can do with a dynamic type system.
Anyone up for writing such a high-quality
book as this one on statically-typed languages,
Not a book, but maybe "The Essence of ML Type Inference"
by Pottier and Remy [1] is of interest. It's a bit more in-depth than TAPL.[1] gallium.inria.fr/~fpottier/publis/emlti-final.pdf
Some of us have written 1 or 2 dynamic, interpreted languages, feel pretty comfortable with those concepts, and are interested in transiting to more advanced, static type systems and writing a good type checker.
Anyone up for writing such a high-quality book as this one on statically-typed languages, ideally functional languages? The only decent books I've found on the subject are 20-30 year-old textbooks. I'm watching "Write You a Haskell" with interest (and have partially read it), even though I'm more into ML and Scala than Haskell, but it's still pretty unfinished.
There's also the plzoo, which is a great resource but not a book.
Oh, and I definitely need to read Pierce's Types and Programming Languages textbook, I've ordered it and need to sit down with it. I suspect it will be very enlightening.
But a more approachable book on statically-typed languages in the same genre as this one is (popular, less academic) would also be welcome.