Re:So you want to be a compiler wizard (2016)
by PeCaN on Sunday April 12, 2020 @04:11PM
(#22850706)
Type checkers are actually surprisingly easy to write. I recommend learning about unification (in the logic sense), maybe just by playing around with Prolog. After you understand that I think type checking is rather easy to figure out (it's literally just unification).
[ Parent
| on HN ]
Re:So you want to be a compiler wizard (2016)
by chubot on Sunday April 12, 2020 @04:22PM
(#22850772)
I think it depends on whether you have type inference or not. If you have type inference, then it's like unification. If you have explicit type annotations, it's even simpler than that.
Re:So you want to be a compiler wizard (2016)
by seanmcdirmid on Sunday April 12, 2020 @11:09PM
(#22852838)
And if you want nominal sub typing, F-bounded generics, and some inference, things get really fun.
Re:So you want to be a compiler wizard (2016)
by rurban on Monday April 13, 2020 @08:19AM
(#22855171)
Nominal subtyping is trivial and unsafe. The fun starts with structural subtyping.
Re:So you want to be a compiler wizard (2016)
by seanmcdirmid on Monday April 13, 2020 @10:30AM
(#22856136)
Nominal sub typing is hard from trivial and calling it unsafe is non-sensical. Structural subtyping yields poor error messages and does not support encapsulation very well, especially if you also want separate compilation.