Registered: Jun, 2005
Re: Typing like a Functional Programmer
Posted: Nov 29, 2006 10:34 AM
> > And yet those are mostly written in an imperative
> > language. You also wrote HeronFront in C++, not
> > ML or Lisp. My point here is just an observation that
> > languages never made it to the mainstream software
> > development, even after almost 50 years of R&D,
> > some ideas from FP are making their way into imperative
> > languages. I think a "hybrid" language might be able to
> > offer the best of both worlds.
> Functional programming contains many useful and valuable
> constructs (like currying that Chris kindly enough
> explained) but it also contains an irritating feature
> called 'referential transparency'.
> The benefits of functional programming come not from
> referential transparency but lack of state dependencies
> between functions. Referential transparency gets in the
> I have written a blog in which I explain why:
Currying is nice when you look at it in isolation, but my question is whether constructs like that offer real advantage _most_ of the time when developing large systems. It is true that different problems might require FP style, but the question is how often is that the case and is it justified to sacrifice techniques that imperative programming offers? If it's not very often then we're better off using a language like C++ that can allow us to use a limited form of FP only when we need it. For example, it's not true that most of the time everything should be a function or that most functions need to be curried or that we need to pass and return functions/lambda-expressions most of the time. I just think that FP style offers advantages in certain types of problems, so it should be used _only_ when such problems occur, rather than imposing it on programmers all the time.