Comment by eru
12 years ago
> People like to rag on lisp, but their language dujour just got what lisp's been packing for at least 20 years.
Strong static typing? ;o)
12 years ago
> People like to rag on lisp, but their language dujour just got what lisp's been packing for at least 20 years.
Strong static typing? ;o)
Well as I have pointed out before, I am still learning but there are few interesting propositions here.
core.typed - Type Clojure, but still not complete
Shen - despite its questionable licensing scheme, it is a derivative of Qi. Qi and Shen are very powerful types systems (not just Haskell, but think even more complex like Idris, Coq, Agda, etc). The original implementations, if you want irony, are Common Lisp. The caveat is Shen has been ported to other runtimes, namely, Python and Ruby. But SBCL is the preferred runtime layer for Shen's crazy type system.
Typed Racket - It is a Scheme, and people will throw things at me, but I think it safe to say static types for this subset prove Lisp family languages have the potential for robust static typing systems you hint at.
TL;DR: Strong static typing is not common (pun intended), but it is possible. I think what we want to see is Shen with a good license: a very robust type system with a Lisp, separate or library. Then, Lisp will be the one ring-language to rule them all.
Perhaps we can call this library or Lisp variant Precious, and its hipster vote can go through the charts.
Common Lisp already features strong static typing (the example below uses SBCL):
One could also declare the function signature first (perhaps in skeleton code generated by modelling tools). Then, if someone implements it incorrectly, the compiler will throw an error (again, SBCL):
So, what else do you think Common Lisp lacks compare to more "modern" languages? ;)
That's nice. What type system is that? Does it support eg parametricity?
That's the standard type system in Common Lisp.
As for whether Common Lisp supports parametricity, I don't know. It might be one of those things that isn't difficult to implement on your own, like design-by-contract or AMOP.