Clojure static typing -


i know may sound blasphemy lisp aficionados (and other lovers of dynamic languages), how difficult enhance clojure compiler support static (compile-time) type checking?

setting aside arguments , against static , dynamic typing, possible (not "is advisable")?

i thinking adding new reader macro force compile-time type (an enhanced version of #^ macro) , adding type information symbol table allow compiler flag places variables misused. example, in following code, expect compile-time error (#* "compile-time" type macro):

(defn get-length [#*string s] (.length s)) (defn test-get-length [] (get-length 2.0)) 

the #^ macro reused global variable (*compile-time-type-checking*) force compiler checks.

any thoughts on feasibility?

it's possible. compiler static type checking around primitive argument types in 1.3 development branch.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -