Are you interested in the actual type checking algorithms, or just the type
systems?

Big differences of the type systems:

* Elm has tagged union types, meaning that you can make a value that many
have one of many types, and pattern match on its possible variants.

* Elm has type inference, Java does not. When you declare a variable in
Java, you need to know what type it is. There's no such need in Elm.

* Elm has first-class functions, so variables can have type a -> b, and you
can build arbitrarily complicated types using function types, put them in
tuples, etc.

* Java has classes, subtyping, inheritance, etc. Elm doesn't have that,
because subtyping gets in the way of inference, and because it's not nearly
as necessary when you don't have mutable data.

There are many other differences between the languages, but they're not
necessarily differences in the type system. For example, Java has mutable
variables and Elm does not, but there are strongly typed functional
languages, like ML, which have mutable variables.

As for the actual typechecking algorithms, Elm uses something like Algorithm
W
<https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system#Algorithm_W>,
but a more advanced, constraint-based version which helps with speed and
can actually accept a few more programs.
 Typechecking is based on unification.
I can't speak too much about Java, but I imagine they're using something
like abstract interpretation to typecheck.

On Tue, May 24, 2016 at 10:49 AM, John Orford <john.orf...@gmail.com> wrote:

> Can someone /wittily/ sum up the experience of type checking in Java vs
> something pure like Elm?
>
> I feel purity, preciseness and descriptiveness is the main difference
> somehow...
>
> Java is too long in the distant past for me, but it's something I love
> about Elm and never really cared for in languages like Java etc.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to