Hacker News new | ask | show | jobs
by norswap 3669 days ago
First, functional programming is an umbrella term. This paper talks about strict FP, which is basically "no mutation", so I'll talk about that.

It's clear that some other aspects of FP, such as first-order functions, closures, etc are very useful in practice.

Immutability does have its advantages in that it supplies strong guarantees about what your code does. It avoids spaghetti code where everything can and does mutate everything else.

Myself, I tend to use whenever its advantages outweigh its inconveniences. Immutability is especially handy at interface boundaries.

2 comments

I agree that immutability is very useful, but you don't really need any kind of FP to use immutability, do you?
If your data is immutable, in what sense is your code not 'Functional Programming?'

"It's OO, and it can't be both OO and FP."

Hmmm.

I was going to say the same thing; it's certainly possible to write immutable object oriented code
Indeed, it's more of a pattern.
You're confusing first-class and higher-order functions.