Posts Tagged ‘Immutable’

Functional Language Explosion

Saturday, October 18th, 2008

There is suddenly a lot of interest in functional languages recently.  The two advantages are

  • Writing a DSL (Domain Specific Language)
  • Writing concurrent code

The languages that seem to come up are:

  • Clojure (JVM)
  • F# (based on OCaml, Haskell, and ML) (.Net CLR)
  • Erlang (JVM)

I'm not particularly interested in DSL (despite my last post on code generators), however as CPUs contain more and more cores, we'll need a way to safely write multithreaded code.

The Clojure project has an interesting post on its approach on simplifying multithreaded code.

Erlang handles concurrency by only having local variables and providing a way to send messages to and from other threads.

Lastly, MPI is a .Net library for distributed processing where the same program executes multiple times and each instance communicates with each other using message passing which sounds very Erlang-like.

Advantages of Immutable Data

Saturday, February 16th, 2008

I was reading about two of Google's internal programs, Bigtable and Google File System, and how they handle a large amounts of data so that the processing is distributed (Bigtable) and the data is replicated (Google File System). One thing they both do is exploit immutability. So once something is saved to disk, that block of data doesn't change. If you have a large volume of data, this assumption can be very useful.

Let's say we're talking about a transaction table for bank accounts. Records in the transaction table don't change. Any corrections are handled by creating a new transaction record at the tail end of the table. If you are processing the transactions, this is great! You can ignore previously processed records since you know they will never change.