Tuesday, November 18, 2008

Compilers and patterns

I was just reading another interesting "philosophical" piece on the difference between functional and procedural languages here

It is true that from functional viewpoint patterns can be easily described with recursion and thus easily reduced to simpler structures. It is not necessary to first define and create classes, and then let them call theirselves recursively as demonstrated here:


new Mul(
new Sub(new Num(6), new Num(2)),
new Add(new Num(2), new Num(3))).calc()));


Again recursion can make the translatation between structures a transparent process.

The pattern here is