News for hackers. Stuff that matters.
Re:A Practical Optional Type System for Clojure by pufuwozu on Thursday October 25, 2012 @11:01AM (#4697869)
Overall, the work described in this dissertation leads to the conclusion that it appears to be both practical and useful to design and implement an optional static type system for the Clojure programming language.

I'm a huge type safety fan (see http://roy.brianmckenna.org/) so this is pretty amazing. I'm definitely going to play around with Ambrose's work.

Had a quick look, it's really exciting that the algo.monads was almost completely type-checkable with this system.

Leaves me with a couple of questions:

Multimethods are untyped. Anyone able to comment on how often multimethods are used in idiomatic Clojure code?

Anyone know if this work could eventually allow protocols to become full type-classes (allowing dispatch based on return type of protocol methods)? Am I misunderstanding how protocols are compiled?

Hopefully the videos for Typed Clojure at Clojure Conj 2012 will be posted soon after the talk is given :)

My only fear is that optional typing would be less useful than optional untyping. When you have libraries that are untyped, they're a pain to use from a typed language. The other way around is not true.

Re:A Practical Optional Type System for Clojure by ambrosebs on Thursday October 25, 2012 @12:41PM (#4698262)
Multimethods are an awesome feature, which I'm a big fan of, but they were lower on my priority list so I haven't got around to typing them. It's not clear how comprehensively they can be typed either, I comment about it in "Future work".

I don't know a lot about type-classes, but I'm doubtful that Typed Clojure could help make protocols like them. I would expect a whole different dispatch system would need to be designed. But that's mostly a hunch. Very interesting problem.

If you want to play around with this kind of stuff immediately, check out Typed Racket. The Typed Clojure implementation is in alpha and might not be very friendly yet :) That said, please try it out!

Re:A Practical Optional Type System for Clojure by noelwelsh on Thursday October 25, 2012 @11:08AM (#4697897)
If you like this work you'll also like Typed Racket, on which it is based. Sam TH is the main author and his publications are here: http://www.ccs.neu.edu/home/samth/
Re:A Practical Optional Type System for Clojure by chadzawistowski on Thursday October 25, 2012 @02:57PM (#4698964)
The first thing I thought of while opening this article was Qi / Shen, an optionally typed Lisp which takes inspiration from the ML family of languages. http://www.shenlanguage.org/

Shen's dedication to providing functional concepts such as partial application really interests me, but I find Clojure's practical nature even more enticing. Perhaps Typed Racket and this type system for Clojure will provide the best of both worlds!

Re:A Practical Optional Type System for Clojure by ambrosebs on Thursday October 25, 2012 @08:42PM (#4700320)
Shen is pretty amazing and is built with a type system in mind from the beginning. If you don't want the type system, just turn it off, in the middle of a REPL session if you want!
Re:A Practical Optional Type System for Clojure by firlefans on Thursday October 25, 2012 @11:08AM (#4697893)
I am not sure about the motivation for this project but this article helps explain why some folks are interested in type systems as detachable (pluggable) components, separate from languages:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.175...

Re:A Practical Optional Type System for Clojure by pufuwozu on Thursday October 25, 2012 @11:17AM (#4697926)
I've read a few of Gilad's papers - I just don't see how they can be practical in a world of third-party libraries (e.g. author A hates types, I like type-safety but I have to settle for none when I use that library).
Re:A Practical Optional Type System for Clojure by jamii on Thursday October 25, 2012 @02:04PM (#4698697)
This paper demonstrates an effective way of interfacing between typed and untyped code such that type errors can only happen at the boundaries - not within typed code.

homepages.inf.ed.ac.uk/wadler/papers/blame/blame.pdf

Re:A Practical Optional Type System for Clojure by firlefans on Thursday October 25, 2012 @11:29AM (#4697968)
I guess, but this seems like something that could become a best practice for library authors, and it'd be fairly trivial to retrofit or fork existing libs with annotations.
Re:A Practical Optional Type System for Clojure by Tuna-Fish on Thursday October 25, 2012 @11:13AM (#4697919)
> Multimethods are untyped. Anyone able to comment on how often multimethods are used in idiomatic Clojure code?

Not at all.

Multimethods were Hickeys solution to polymorphism before the Haskell enthusiasts managed to preach the gospel of type classes to him. Today, they are more or less deprecated as a solution to a problem.

Re:A Practical Optional Type System for Clojure by fogus on Thursday October 25, 2012 @11:25AM (#4697957)
> Not at all.

This is categorically false. Multimethods solve a certain problem "open arbitrary function dispatch". Nothing in Clojure aside from multimethods solves this problem. There are many projects that use multimethods to their great advantage, including, but not limited to:

* Clojure

* ClojureScript

* ClojureScript One

Re:A Practical Optional Type System for Clojure by samaaron on Friday October 26, 2012 @04:24AM (#4701339)
Overtone also uses multimethods in a number of places. They're crazy powerful and useful.
Re:A Practical Optional Type System for Clojure by Rayne on Friday October 26, 2012 @04:37AM (#4701369)
They are not even remotely deprecated.