Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Writing a type checker is conceptually much more specialised than just a scripting language. Certainly I have no idea how to write one!


Moreover, designing the actual type system is at least as hard as implementing the type checker. Coming up with a static type system that is flexible/ergonomic, expressive/powerful, sound, easy to use, and also a good match for mutable state and imperative code is really, really difficult, as demonstrated by C, C++, and Java.

A flexible/ergonomic dynamic type system is trivial in comparison. Soundness is handled at runtime when the exact value of each expression is known, and ease of use is almost a given.


Not really. You just need to walk up both types until you find a match. It's similar to a simple eval matcher, which is about 10 lines in lisp.

https://github.com/perl11/Bla has typically the smallest and easiest to understand type inferencer and checker.


It's actually extremely easy, particularly if you're familiar with Prolog (the core algorithm is a couple lines in Prolog, so knowing how that works is useful for implementing it in other languages).

I suspect the lack of statically typed scripting languages is more of a historical accident than anything.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: