

A Practical Optional Type System for Clojure - swannodette
http://cloud.github.com/downloads/frenchy64/papers/paper.pdf

======
pufuwozu
_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.

~~~
Tuna-Fish
> 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.

~~~
fogus
> 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

~~~
samaaron
Overtone also uses multimethods in a number of places. They're crazy powerful
and useful.

------
th0ma5
This is really great, and immaculately put together. Recently though I've come
across people who think that you need strong types when programming, and this
is really weird to me. I think it has its place for sure, and is a great way
to ensure you're being correct, but I also really like not having to mess with
types on hobby projects and such for sure :D

Anyway, great paper.

~~~
Evbn
I love strong types on hobby projects, so I don't have to constantly go back
and fix crash bugs after I get it working once.

~~~
jshen
You must be doing it differently than me, and most other people I've worked
with.

------
ambrosebs
I'll just note that any corrections are more than welcome, this is my first
paper and I've got a lot to learn! Please send them to abonnairesergeant at
gmail dot com.

------
dschiptsov
One of the distinguishing features of a classic Lisp is that values, not
variables have a type-tag and the type-safety checking is performed at
runtime. Everything is a reference (a pointer), everything is a first-class
object (could be passed anywhere), everything is an expression (uniform
syntax).

Ironically, Clojure is, a Java in the land of Lisp. They broke the abstraction
layers, mess up logic with implementation, introduce not just different kind
of parenthesis, but redundant and irrelevant data-structures and ruined the
magic of "everything is a list". Look what a classic 3-lines 'keep function
became.)

~~~
lukev
> but redundant and irrelevant data-structures

Now you're just trolling. Clojure's immutable persistent data structures are
one of the primary strengths of the language, and what I tend to miss most
when I'm working in another language.

~~~
dschiptsov
It is not about collections, it is about breaking the conceptual unity of the
core language by using [] for a parameter.. array.)

~~~
dschiptsov
Oh, excuse me, not an array, I'm old fashioned - heterogeneous vector!)

~~~
firlefans
You say array, I say heterogenous vector, let's call the whole thing off!

