Erlang / FP and Java

David Hopwood <>
Thu Jul 15 20:10:23 CEST 2004


Mickaël Rémond wrote:
> Hello,
> 
> The functional paradigm is progressing even amongst Java developers ;-)

Well, amongst people who write articles aimed at Java developers :-)

> Here is an interesting article on IBM developerwork explaining how to  
> write functional programming oriented code in Java for modularity:
> 
> http://www-106.ibm.com/developerworks/library/j-fp.html?ca=drs-tp2904
> 
> Erlang is even mentioned.

The problems with trying to do functional programming in Java are that
(pre 1.5) it has a monomorphic, manifest static type system, and it
was not designed to have a concise syntax for closures. This leads to
verbose and difficult-to-read code that obscures the advantages of FP.
The examples in the article only serve to confirm this.

The generic types in Java 1.5
(http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf) may help slightly,
but I doubt they will help enough: to naturally support FP, a language
preferably needs Hindley-Milner-style type inference, or if not then
dynamic typing.

-- 
David Hopwood <>



More information about the erlang-questions mailing list