Archive for the ‘ComSci’ Category

Faith, Evolution, and Programming Languages

November 28th 2007

I just watched Faith, Evolution, and Programming Languages, a Google EngEDU video. It was by Philip Wadler, a chap who I had never heard of but who has done loads of cool things. He designed Haskell’s Type Classes and Java’s Generics, and is currently working on a bridge between strongly typed and dynamically typed languages. The talk starts off with a brief, fascinating explanation of links (more properly isomorphisms) between logics and programming languages and makes the point that aliens may not create Java but certainly will create (discover?, I suppose it depends if you are a Platonist) the lambda calculus (calculi ?).

For about 20 mins towards the end I lost the plot and could not really follow his argument, but I will revisit it when I know a bit more. I am glad I hung on as the 10 minutes of discussion at the end were quite interesting and Links (the recent work he did not have time to show the slides for, a web framework with every tier written in the same language) seemed very interesting.

For more on the language/logic link, see here

Posted by tom under ComSci & haskell & Java | No Comments »

Why I am learning Haskell

November 27th 2007

I saw Simon Peyton-Jones talk on Software Transactional Memory at OSCON and was amazed at how neat it sounded. Taking some ideas from databases to remove some of the pain of multithreaded programming is a great idea. His point that a thread-safe Dequeue is a post-doc publishable result convinced me that something is wrong with the threading models in widespread use, while STM reduces it to an undergrad problem. The maping from the complexity of the problem domain to your code should be sane, if implementing a a simple structure like a dequeue using threads makes the code lots longer and requires a large amount of effort by someone with a doctorate, something is wrong. I love python, but multithreaded programs suffer (at least in the C implementation) because of the global interpretor lock (GIL). So I decided to learn Haskell.

There are (as far as I know) two ways of doing concurrency; shared state and message passing. STM is a neat syntax and smart compiler technology that ultimately uses shared state. See a Java or C# implementation here.

Erlang is becoming increasingly popular and big successes with high availability at Ericsson are compelling real world examples of its use. It uses message passing concurrency and is a nice (mostly) functional language. I am happy with the choice of Haskell though, the syntax seems neat (because of my maths background) and the functional purity enforces functional thinking more than (say) Common Lisp or OCaml. There was a great post today on Planet Haskell on concurrency options in Haskell and I am keen to explore them.

Maybe I will not hack in Haskell full time, but I think some of the ideas will go mainstream (already appearing in Linq and C# from Microsoft, who have bought in a lot of talented folk from the FP world ), but maybe I will.

It fits my mind well so far.

Posted by tom under ComSci & FP & haskell | No Comments »

Mind Bending Stuff

November 1st 2007

I am just getting my head around this (pdf) comment on the problem at the last ICFP Programming Contest , anyone who likes puzzles, compilers and reverse engineering should take a look, I am amazed by how rich this problem was. The ICFP do not specify what counts as “functional”, but OCaml and Haskell usually do very well in the contest. This year a C++ team won it and a perl team came second, after lots of teams abandoned their functional languages. The authors make the point that data structure design/choice is very important (which we all should know I suppose), they recommend Data.sequence in Haskel and I think it is similar to a Rope (sort of tree based string representation that makes concatenation a snip, wikipedia is weak on it but Ruby Quiz mentioned it a few weeks ago)

Posted by tom under ComSci & FP & haskell & OCaml | No Comments »